Skip to content

Instantly share code, notes, and snippets.

@raykipkorir
Created August 7, 2023 07:07
Show Gist options
  • Save raykipkorir/437f888d5c1aaf8b2c7984083518c861 to your computer and use it in GitHub Desktop.
Save raykipkorir/437f888d5c1aaf8b2c7984083518c861 to your computer and use it in GitHub Desktop.
Django and PostgreSQL services in docker compose - for local development
version: "3.8"
services:
django:
build:
context: .
dockerfile: Dockerfile
image: local_django
container_name: local_django
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
volumes:
- .:/app
env_file:
- .env
depends_on:
- postgres_local_db
postgres_local_db:
image: postgres
container_name: local_postgres
environment:
POSTGRES_USER: ${SQL_USER}
POSTGRES_PASSWORD: ${SQL_PASSWORD}
POSTGRES_DB: ${SQL_DATABASE}
volumes:
- postgres_local_data:/var/lib/postgresql/data
volumes:
postgres_local_data:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment