added protections when installing wp

This commit is contained in:
hulamy
2022-09-25 22:11:05 +02:00
parent 7a6734045c
commit 10877ee675
4 changed files with 45 additions and 16 deletions

View File

@@ -24,11 +24,11 @@ RESET = "\e[0m"
COMPOSE = ./srcs/docker-compose.yml
#V_USER = hulamy
#V_USER = $(shell echo $(USER)) # gives root when make is run with sudo
#V_USER = $(shell who | head -1 | tr " " "\n" | head -1) # gives bad result when in `sudo su`
#V_USER = $(shell who | head -1 | cut -d " " -f 1) # gives bad result when in `sudo su`
V_USER = $(shell who | head -1 | cut -d " " -f 1)
#V_USER = $(shell users | tr " " "\n" | head -1)
V_USER = hulamy # same as 'LOGIN' var in .env file
VOLUMES_D = /home/$(V_USER)/data/wp_volume \
/home/$(V_USER)/data/db_volume
@@ -43,13 +43,13 @@ VOLUMES = $(shell docker volume ls -q)
all: build up
$(VOLUMES_D):
volumes:
mkdir -p $(VOLUMES_D)
build:
docker-compose -f $(COMPOSE) build
up: $(VOLUMES_D)
up: volumes
docker-compose -f $(COMPOSE) up
# list images, containers, volumes
@@ -78,7 +78,6 @@ fclean-images: clean
docker system prune -af
fclean-volumes: clean
- docker volume rm $(VOLUMES)
fclean-test:
- rm -rf $(VOLUMES_D)
fclean: fclean-images fclean-volumes