-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
56 lines (56 loc) · 1.24 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
services:
api:
container_name: api
build:
context: .
dockerfile: Dockerfile
environment:
PORT: "${PORT}"
DB_USER: "${MYSQL_USER}"
JWT_SECRET: "${JWT_SECRET}"
DB_PASSWORD: "${MYSQL_PASSWORD}"
DB_NAME: "${MYSQL_DATABASE}"
DB_PORT: "${MYSQL_PORT}"
DB_HOST: mysql
ports:
- "${PORT}:${PORT}"
networks:
- mysql
depends_on:
db:
condition: service_healthy
logging:
driver: "json-file"
options:
max-size: "1k"
max-file: "3"
db:
image: mysql:8
container_name: mysql
restart: always
environment:
MYSQL_DATABASE: "${MYSQL_DATABASE}"
MYSQL_USER: "${MYSQL_USER}"
MYSQL_PASSWORD: "${MYSQL_PASSWORD}"
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
ports:
- "${MYSQL_PORT}:${MYSQL_PORT}"
expose:
- "${PORT}"
volumes:
- ./data:/var/lib/mysql
logging:
driver: "json-file"
options:
max-size: "1k"
max-file: "3"
networks:
- mysql
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-uroot", "-p${MYSQL_ROOT_PASSWORD}"]
interval: 5s
timeout: 5s
retries: 10
networks:
mysql:
name: mysql