-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
50 lines (46 loc) · 977 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
43
44
45
46
47
48
49
50
version: '3.8'
services:
api-server:
build:
context: .
dockerfile: ./Dockerfile
restart: always
ports:
- 8000:8000
depends_on:
- mysql
env_file:
- .env
volumes:
- ./:/app
command: python -m uvicorn main:app --host 0.0.0.0 --port 8000
networks:
- tobid
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:3306" ]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
mysql:
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
env_file:
- .env
ports:
- 3306:3306
volumes:
- ./mysql_db:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: [ "CMD-SHELL", "mysqladmin ping -h localhost --silent" ]
interval: 10s
timeout: 5s
retries: 3
networks:
- tobid
volumes:
mysql_db:
networks:
tobid: