changed gestion of home user in makefile and env and docker-compose

This commit is contained in:
Hugo LAMY
2022-09-26 16:05:42 +02:00
parent 0de8c248fe
commit 67c0bd1a40
3 changed files with 8 additions and 10 deletions

View File

@@ -25,20 +25,20 @@ RESET = "\e[0m"
COMPOSE = ./srcs/docker-compose.yml
# same as 'LOGIN' var in .env file
#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 users | tr " " "\n" | head -1)
V_USER = hulamy
VOLUMES_D = /home/$(V_USER)/data/wp_volume \
/home/$(V_USER)/data/db_volume
V_HOME = $(HOME)
VOLUMES_D = $(V_HOME)/data/wp_volume \
$(V_HOME)/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)
# list of volumes
VOLUMES = $(shell docker volume ls -q)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

View File

@@ -1,8 +1,4 @@
# DOCKER-COMPOSE
LOGIN=hulamy
# MARIADB SETUP
DB_HOST=mariadb

View File

@@ -78,13 +78,15 @@ volumes:
driver_opts:
type: none
o: "bind"
device: /home/${LOGIN}/data/wp_volume
device: ${HOME}/data/wp_volume
# device: /home/${LOGIN}/data/wp_volume
db_volume:
driver: local
driver_opts:
type: none
o: "bind"
device: /home/${LOGIN}/data/db_volume
device: ${HOME}/data/db_volume
# device: /home/${LOGIN}/data/db_volume
networks:
inception: