Skip to content

Instantly share code, notes, and snippets.

@Cosikowy
Created February 27, 2023 00:11
Show Gist options
  • Save Cosikowy/042b9f8c3172ca90317c3211dd90e834 to your computer and use it in GitHub Desktop.
Save Cosikowy/042b9f8c3172ca90317c3211dd90e834 to your computer and use it in GitHub Desktop.
Docker-compose + django - wait for db to be up then start django server
services:
app:
build:
dockerfile: dockerfile
context: .
ports:
- 8000:8000
entrypoint: python manage.py runserver 0.0.0.0:8000
env_file: .env
volumes:
- ./:/app/
depends_on:
db:
condition: service_healthy
db:
image: postgres:15.2
ports:
- 5432:5432
env_file: .env
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment