generated from ouslan/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
61 lines (56 loc) · 1.15 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
services:
database:
image: postgres:17
container_name: api_database
restart: always
deploy:
resources:
limits:
cpus: '2'
memory: 2G
secrets:
- db-password
ports:
- 5555:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD_FILE: /run/secrets/db-password
POSTGRES_DB: postgres
volumes:
- database_volume:/var/lib/postgresql/data
networks:
- api_network
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"]
interval: 5s
timeout: 3s
retries: 5
api:
container_name: FastAPI
build:
context: .
restart: always
secrets:
- db-password
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD_FILE: /run/secrets/db-password
POSTGRES_DB: postgres
POSTGRES_PORT: 5555
volumes:
- data_folder:/app/data
ports:
- 8051:8000
networks:
- api_network
depends_on:
database:
condition: service_healthy
networks:
api_network:
volumes:
database_volume:
data_folder:
secrets:
db-password:
file: password.txt