Skip to content

Commit 230dcf4

Browse files
committed
docker compose file for prod setup
1 parent a82e48b commit 230dcf4

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

docker-compose.prod.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
services:
2+
flask-app-1:
3+
build:
4+
context: ../app
5+
dockerfile: Dockerfile
6+
image: flask-app:1.0.0
7+
container_name: flask-container-1
8+
restart: always
9+
env_file:
10+
- ../.env.prod
11+
depends_on:
12+
postgres:
13+
condition: service_healthy
14+
volumes:
15+
- ../:/app
16+
17+
flask-app-2:
18+
build:
19+
context: ../app
20+
dockerfile: Dockerfile
21+
image: flask-app:1.0.0
22+
container_name: flask-container-2
23+
restart: always
24+
env_file:
25+
- ../.env.prod
26+
depends_on:
27+
postgres:
28+
condition: service_healthy
29+
volumes:
30+
- ../:/app
31+
32+
postgres:
33+
image: postgres:13
34+
container_name: postgres-container
35+
restart: always
36+
env_file:
37+
- ../.env.prod
38+
ports:
39+
- "5432:5432"
40+
volumes:
41+
- pgdata:/var/lib/postgresql/data
42+
healthcheck:
43+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-postgres}"]
44+
interval: 10s
45+
timeout: 20s
46+
retries: 5
47+
48+
nginx:
49+
image: nginx:alpine
50+
container_name: nginx-container
51+
restart: always
52+
ports:
53+
- "80:80"
54+
volumes:
55+
- ../nginx/nginx.conf:/etc/nginx/nginx.conf:ro
56+
depends_on:
57+
- flask-app-1
58+
- flask-app-2
59+
60+
volumes:
61+
pgdata:
62+
driver: local

0 commit comments

Comments
 (0)