generated from Louis3797/express-ts-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathdocker-compose.yml
42 lines (40 loc) · 936 Bytes
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
version: '3.9'
services:
# Express Server
auth-service:
build:
context: .
dockerfile: Dockerfile
image: auth-service:latest
container_name: auth-service
ports:
- '${PORT}:${PORT}'
env_file:
- ./.env
environment:
NODE_ENV: production
DATABASE_URL: mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3307/${MYSQL_DATABASE}
PORT: 4040
depends_on:
- mysql
restart: unless-stopped
command: ["dumb-init", "node", "dist/index.js"]
# MySQL Database
mysql:
image: mysql:8.0
container_name: mysql
volumes:
- db-data:/var/lib/mysql
ports:
- '3307:3306'
environment:
# ! dont use root user in prod
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: root
MYSQL_PASSWORD: ${MYSQL_ROOT_PASSWORD}
env_file:
- ./.env
restart: always
volumes:
db-data: