Skip to content

Commit 965af3e

Browse files
added healthcheck so that django can wait until db starts
1 parent 8c8f2aa commit 965af3e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docker-compose.yml

+10
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,20 @@ services:
1919
python manage.py runserver 0.0.0.0:8000"
2020
env_file:
2121
- .env
22+
depends_on:
23+
db:
24+
condition: service_healthy
25+
links:
26+
- db
2227
<<: *default-logging
2328

2429
db:
2530
image: postgres:alpine
31+
healthcheck:
32+
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
33+
interval: 5s
34+
timeout: 5s
35+
retries: 5
2636
environment:
2737
- POSTGRES_DB=postgres
2838
- POSTGRES_USER=postgres

0 commit comments

Comments
 (0)