Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/go-postgres/.devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

volumes:
postgres-data:

Expand All @@ -26,6 +24,16 @@ services:
db:
image: postgres:latest
restart: unless-stopped

# Health check ensures PostgreSQL is ready before dependent services start
# This is critical for depends_on with condition: service_healthy to work properly
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 10s # Check every 10 seconds
timeout: 5s # Wait up to 5 seconds for response
retries: 5 # Retry 5 times before marking as unhealthy
start_period: 30s # Give PostgreSQL 30 seconds to start before health checks begin

volumes:
- postgres-data:/var/lib/postgresql
env_file:
Expand Down
Loading