Skip to content

Instantly share code, notes, and snippets.

@raccoonyy
Created March 9, 2017 14:42
Show Gist options
  • Save raccoonyy/2db75b86f73bc0b337a0c2c3f94709a1 to your computer and use it in GitHub Desktop.
Save raccoonyy/2db75b86f73bc0b337a0c2c3f94709a1 to your computer and use it in GitHub Desktop.
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