-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
51 lines (47 loc) · 1.12 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
services:
db:
image: mysql:8.0.19
command: '--default-authentication-plugin=mysql_native_password'
restart: always
healthcheck:
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --password="$$(cat /run/secrets/db-password)" --silent']
interval: 3s
retries: 5
start_period: 30s
secrets:
- db-password
# volumes: # this is how we persist a sql db even when container stops
# - ./db/data:/var/lib/mysql
environment:
- MYSQL_DATABASE=example
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin
ports:
- 8001:80
environment:
- PMA_HOST=db
- PMA_PORT=3306
api:
build:
context: app
target: builder
container_name: fastapi-application
depends_on:
- db
secrets:
- db-password
volumes:
- ./app:/code
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
environment:
PORT: 8000
ports:
- '8000:8000'
restart: always
volumes:
db-data:
secrets:
db-password:
file: db/password.txt