Create a gist now

Instantly share code, notes, and snippets.

version: '2.1'
volumes:
django_sample_db_dev: {}
services:
db:
image: postgres:9.6.1
volumes:
- django_sample_db_dev:/var/lib/postgresql/data
environment:
- POSTGRES_DB=sampledb
- POSTGRES_USER=sampleuser
- POSTGRES_PASSWORD=samplesecret
- POSTGRES_INITDB_ARGS=--encoding=UTF-8
healthcheck:
test: "pg_isready -h localhost -p 5432 -U postgres"
interval: 3s
timeout: 1s
retries: 10
django:
build:
context: .
dockerfile: ./compose/django/Dockerfile-dev
environment:
- DJANGO_DEBUG=True
- DJANGO_DB_HOST=db
- DJANGO_DB_PORT=5432
- DJANGO_DB_NAME=sampledb
- DJANGO_DB_USERNAME=sampleuser
- DJANGO_DB_PASSWORD=samplesecret
- DJANGO_SECRET_KEY=dev_secret_key
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
links:
- db
command: /start-dev.sh
volumes:
- ./manage.py:/app/manage.py
- ./requirements.txt:/app/requirements.txt
- ./requirements-dev.txt:/app/requirements-dev.txt
- ./djangosample:/app/djangosample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment