forked from nakamasato/fastapi-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
39 lines (38 loc) · 903 Bytes
/
docker-compose.yaml
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
version: "3.8"
services:
mysql:
image: mysql:8
command:
- --default-authentication-plugin=mysql_native_password
restart: always
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 45s
interval: 5s
retries: 20
environment:
MYSQL_DATABASE: test_db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: root
api:
build:
context: ./app
depends_on:
mysql:
condition: service_healthy
volumes:
- ./app/:/app/
ports:
- "8000:8000"
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
environment:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_HOST: mysql
MYSQL_DATABASE: test_db
healthcheck:
test: "curl -f http://localhost:8000/ || exit 1"
timeout: 45s
interval: 5s
retries: 20