fail to create volumes

+ again changes in makefile, to be abble to erase volumes only
This commit is contained in:
hugo gogo
2022-09-18 22:43:04 +02:00
parent 9708715bb5
commit 2ffe611dd9
4 changed files with 66 additions and 33 deletions

View File

@@ -24,14 +24,16 @@ RESET = "\e[0m"
COMPOSE = ./srcs/docker-compose.yml
HOME_D = $(shell echo $(HOME))
VOLUMES_D = $(VOLUMES:%=$(HOME_D)/%)
USER = lenovo
VOLUMES_D = /home/$(USER)/data/wp_volume \
/home/$(USER)/data/db_volume
SUDO =
# list of running containers, see : https://stackoverflow.com/questions/10024279/how-to-use-shell-commands-in-makefile
RUNNING = $(shell $(SUDO) docker ps -q)
# list of volumes
VOLUMES = $(shell $(SUDO) docker volume ls -q)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
@@ -40,7 +42,8 @@ RUNNING = $(shell $(SUDO) docker ps -q)
all: build $(VOLUMES_D) up
$(VOLUMES_D):
mkdir -p $(VOLUMES_D)
echo volumes
# mkdir -p $(VOLUMES_D)
build:
$(SUDO) docker-compose -f $(COMPOSE) build
@@ -56,18 +59,23 @@ list:
@$(SUDO) docker ps -a
@echo $(B_YELLOW)"\nvolumes:"$(RESET)
@$(SUDO) docker volume ls
@echo $(B_YELLOW)"\nnetworks:"$(RESET)
@$(SUDO) docker network ls
@echo ""
# remove project images and containers not used
clean:
- $(SUDO) docker stop $(RUNNING)
$(SUDO) docker network prune -f
$(SUDO) docker system prune -f
# remove every dockers
fclean:
# remove everything
fclean-images: clean
- $(SUDO) docker stop $(RUNNING)
$(SUDO) docker system prune -af --volumes
/bin/rm -rf $(VOLUMES_D)
$(SUDO) docker system prune -af
fclean-volumes: clean
- $(SUDO) docker volume rm $(VOLUMES)
fclean: fclean-images fclean-volumes
re: fclean all