Skip to content

Commit

Permalink
Check db is ready before starting web container
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcretu committed Jul 26, 2023
1 parent 0d6716f commit 4215a2a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.8"

services:
web:
Expand All @@ -10,7 +10,8 @@ services:
- "3000:3000"
- "4000:4000"
depends_on:
- db
db:
condition: service_healthy
links:
- db

Expand All @@ -21,3 +22,10 @@ services:
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASS=postgres
restart: on-failure
healthcheck:
test: "PGUSER=$$POSTGRES_USER PGPASSWORD=$$POSTGRES_PASS PGHOST=localhost pg_isready"
# TODO: enable start_interval once docker 25.0.0 is released
# https://github.com/moby/moby/issues/45897
# start_period: 60s
# start_interval: 5s

0 comments on commit 4215a2a

Please sign in to comment.