makefile added down rule
+ makefile change back to user instead of home
This commit is contained in:
11
Makefile
11
Makefile
@@ -29,10 +29,9 @@ COMPOSE = ./srcs/docker-compose.yml
|
||||
#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 users | tr " " "\n" | head -1)
|
||||
V_HOME = $(HOME)
|
||||
VOLUMES_D = $(V_HOME)/data/wp_volume \
|
||||
$(V_HOME)/data/db_volume
|
||||
V_USER = $(shell users | tr " " "\n" | head -1)
|
||||
VOLUMES_D = /home/$(V_USER)/data/wp_volume \
|
||||
/home/$(V_USER)/data/db_volume
|
||||
|
||||
# list of running containers, see : https://stackoverflow.com/questions/10024279/how-to-use-shell-commands-in-makefile
|
||||
RUNNING = $(shell docker ps -q)
|
||||
@@ -45,6 +44,7 @@ VOLUMES = $(shell docker volume ls -q)
|
||||
all: build up
|
||||
|
||||
volumes:
|
||||
sed -i "s/^LOGIN=.*/LOGIN=$(V_USER)/g" ./srcs/.env
|
||||
mkdir -p $(VOLUMES_D)
|
||||
|
||||
build:
|
||||
@@ -53,6 +53,9 @@ build:
|
||||
up: volumes
|
||||
docker-compose -f $(COMPOSE) up -d
|
||||
|
||||
down:
|
||||
docker-compose -f $(COMPOSE) down
|
||||
|
||||
# list images, containers, volumes
|
||||
list:
|
||||
@echo $(B_YELLOW)"\nimages:"$(RESET)
|
||||
|
||||
@@ -78,15 +78,15 @@ volumes:
|
||||
driver_opts:
|
||||
type: none
|
||||
o: "bind"
|
||||
device: ${HOME}/data/wp_volume
|
||||
# device: /home/${LOGIN}/data/wp_volume
|
||||
device: /home/${LOGIN}/data/wp_volume
|
||||
# device: ${HOME}/data/wp_volume
|
||||
db_volume:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
o: "bind"
|
||||
device: ${HOME}/data/db_volume
|
||||
# device: /home/${LOGIN}/data/db_volume
|
||||
device: /home/${LOGIN}/data/db_volume
|
||||
# device: ${HOME}/data/db_volume
|
||||
|
||||
networks:
|
||||
inception:
|
||||
|
||||
Reference in New Issue
Block a user