From c7d0bcad8552022b499cbdd0fae56ec13d1234b3 Mon Sep 17 00:00:00 2001 From: Noel Palo Date: Fri, 10 Sep 2021 03:24:33 +0800 Subject: [PATCH] feature/DLT-22-env-file-refactor - Refactor variables in the local env file --- docker/docker-compose.yml | 12 ++++++------ docker/environments/local.env | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e4e8ffe..f793b10 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -36,12 +36,12 @@ services: ports: - "3306:3306" volumes: - - "${DB_MYSQL_VOLUME}:/var/lib/mysql" + - "${DB_VOLUME}:/var/lib/mysql" environment: - MYSQL_DATABASE: "${DB_MYSQL_DATABASE}" - MYSQL_USER: "${DB_MYSQL_USER}" - MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD}" - MYSQL_ROOT_PASSWORD: "${DB_MYSQL_ROOT_PASSWORD}" + MYSQL_DATABASE: "${DB_NAME}" + MYSQL_USER: "${DB_USERNAME}" + MYSQL_PASSWORD: "${DB_PASSWORD}" + MYSQL_ROOT_PASSWORD: "${DB_PASSWORD_ROOT}" SERVICE_TAGS: dev SERVICE_NAME: mysql @@ -94,7 +94,7 @@ services: dockerfile: containers/php/Dockerfile image: artisan:laravel-5.8 env_file: - - ../docker/environments/${APP_ENV}.env + - ${PATH_ENV_CONFIGS}/${SYS_ENV}.env working_dir: /var/www/html volumes: - "${PATH_PROJECT_SOURCE}:/var/www/html" diff --git a/docker/environments/local.env b/docker/environments/local.env index a4c0a8f..414c8bb 100644 --- a/docker/environments/local.env +++ b/docker/environments/local.env @@ -1,21 +1,23 @@ # # Docker Environment - Local -# +#============================ -# Enviroment -APP_ENV=local +# ENVIROMENT +SYS_ENV=local # DIRECTORIES / VOLUMES / PATHS -PATH_ENV_CONFIG=../docker/environments/${APP_ENV}.env PATH_PROJECT_SOURCE=../src -PATH_NGINX=../docker/containers/nginx +PATH_NGINX=./containers/nginx PATH_NGINX_CONFIGS=${PATH_NGINX}/conf.d/default.conf -PATH_DATABASE=../docker/volumes/mysql +PATH_ENV_CONFIGS=./environments +PATH_DATABASE=./volumes/mysql # DATABASE -DB_MYSQL_VERSION_MYSQL=5.7.22 -DB_MYSQL_VOLUME=${PATH_DATABASE}/mysql_${DB_MYSQL_VERSION_MYSQL} -DB_MYSQL_DATABASE=db_docker_study -DB_MYSQL_USER=dbUserDev -DB_MYSQL_PASSWORD=dbUserDev123 -DB_MYSQL_ROOT_PASSWORD=dbUserRoot123 +DB_DRIVER=mysql +DB_VERSION=5.7.22 +DB_PORT=3306 +DB_NAME=db_docker_laravel +DB_USERNAME=dbUserDev +DB_PASSWORD=dbUserDev123 +DB_PASSWORD_ROOT=dbUserRoot123 +DB_VOLUME=${PATH_DATABASE}/${DB_DRIVER}_${DB_VERSION} \ No newline at end of file