-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
41 lines (39 loc) · 1.04 KB
/
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
services:
psql-db:
# pull the postgres image from DockerHub
image: postgres:15.2
container_name: psql-db
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "5432:5432"
volumes:
- db-volume:/var/lib/postgresql/data
healthcheck:
# used in flask container depends_on condition to wait for the DB to be ready
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 5
flask-backend:
build: ./flask
container_name: flask-backend
ports:
- "5000:5000"
depends_on:
psql-db:
# waiting for the database to be ready
condition: service_healthy
environment:
RDS_USERNAME: ${POSTGRES_USER}
RDS_PASSWORD: ${POSTGRES_PASSWORD}
RDS_HOSTNAME: psql-db
RDS_PORT: 5432
RDS_DB_NAME: ${POSTGRES_DB}
volumes:
- ./flask/app:/app/app
volumes:
# to persist the database tables
db-volume: