-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
57 lines (53 loc) · 1.38 KB
/
docker-compose.yaml
File metadata and controls
57 lines (53 loc) · 1.38 KB
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
57
version: "3.7"
services:
mysql:
image: mysql:5.7
container_name: mysql
environment:
MYSQL_HOST: mysql
MYSQL_DATABASE: note-app
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 10s
interval: 5s
retries: 5
volumes:
- ./db/schema.sql:/docker-entrypoint-initdb.d/01_schema.sql
- ./db/data.sql:/docker-entrypoint-initdb.d/02_data.sql
- ./db/my.cnf:/etc/mysql/conf.d/my.cnf
fastapi:
build: ./app
depends_on:
mysql:
condition: service_healthy
container_name: fastapi
command: uvicorn main:app --reload --host 0.0.0.0 --port 8000 --log-config log_config.json
volumes:
- ./app/main.py:/usr/src/main.py
- ./app/mysql_client.py:/usr/src/mysql_client.py
- ./app/api:/usr/src/api
- ./app/log_config.json:/usr/src/log_config.json
ports:
- 8000:8000
environment: # TODO: Bundle them into a file
MYSQL_HOST: mysql
MYSQL_DATABASE: note-app
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_ROOT_PASSWORD: root
MYSQL_CONNECT_TIMEOUT: 86400 # one day
front:
build: ./front
depends_on:
- fastapi
container_name: front
ports:
- 8080:80
networks:
default:
name: fastapi