Skip to content

Commit c8ca2eb

Browse files
committed
✨ Update Docker Compose Configuration for Environment Variables
- Modify the compose.yaml file to utilize environment variables for application and database configurations, enhancing flexibility and consistency across environments. - Change NODE_ENV to production and update port configurations to use dynamic environment variables for both application and MySQL services.
1 parent 8918754 commit c8ca2eb

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

compose.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,29 @@ services:
99
env_file:
1010
- .env
1111
ports:
12-
- "3333:3333"
12+
- "${PORT}:3333"
1313
volumes:
1414
- .:/app
1515
- /app/node_modules
1616
environment:
17-
- NODE_ENV=development
17+
- NODE_ENV=production
1818
- DB_HOST=mysql
19-
- DB_PORT=3306
19+
- DB_PORT=${DB_PORT}
2020
- DB_DATABASE=${DB_DATABASE}
2121
- DB_USERNAME=${DB_USERNAME}
2222
- DB_PASSWORD=${DB_PASSWORD}
23+
- PORT=${PORT}
24+
- HOST=${HOST}
25+
- LOG_LEVEL=${LOG_LEVEL}
26+
- APP_KEY=${APP_KEY}
27+
- SESSION_DRIVER=${SESSION_DRIVER}
28+
- DB_CONNECTION=${DB_CONNECTION}
29+
- GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
30+
- GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
31+
- GITHUB_CALLBACK_URL=${GITHUB_CALLBACK_URL}
32+
- TZ=${TZ}
33+
34+
2335
depends_on:
2436
- mysql
2537
command: sh -c "npm install && npm run dev"
@@ -32,7 +44,7 @@ services:
3244
env_file:
3345
- .env
3446
ports:
35-
- "3306:3306"
47+
- "${DB_PORT}:3306"
3648
environment:
3749
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
3850
- MYSQL_DATABASE=${DB_DATABASE}
@@ -55,7 +67,7 @@ services:
5567
environment:
5668
- NODE_ENV=development
5769
- DB_HOST=mysql
58-
- DB_PORT=3306
70+
- DB_PORT=${DB_PORT}
5971
- DB_DATABASE=${DB_DATABASE}
6072
- DB_USERNAME=${DB_USERNAME}
6173
- DB_PASSWORD=${DB_PASSWORD}

0 commit comments

Comments
 (0)