Pārlūkot izejas kodu

feat: implemented user confirmation for safe removal of containers and volumes in Makefile

Patrice-Gaudicheau 1 gadu atpakaļ
vecāks
revīzija
0f6bdaa602
2 mainītis faili ar 11 papildinājumiem un 1 dzēšanām
  1. 3 1
      Makefile
  2. 8 0
      confirm_remove.sh

+ 3 - 1
Makefile

@@ -2,7 +2,9 @@ install:
 	@docker-compose up -d
 
 remove:
-	@docker-compose down -v
+	@chmod +x confirm_remove.sh
+	@./confirm_remove.sh
+
 
 start:
 	@docker-compose start

+ 8 - 0
confirm_remove.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+echo "Warning: This will remove all containers and volumes, including persistent data. Do you want to continue? [Y/N]"
+read ans
+if [ "$ans" == "Y" ] || [ "$ans" == "y" ]; then
+  docker-compose down -v
+else
+  echo "Operation cancelled."
+fi