Skip to content

Instantly share code, notes, and snippets.

@ramboldio
Created January 30, 2017 13:35
Show Gist options
  • Save ramboldio/22d368eecfd7105a7c875136f27cc872 to your computer and use it in GitHub Desktop.
Save ramboldio/22d368eecfd7105a7c875136f27cc872 to your computer and use it in GitHub Desktop.
Dockerfile Django App
version: '2'
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: password
volumes:
- ./dbdata:/var/lib/postgresql/data
web:
# Docker hack to wait until Postgres is up, then run stuff.
command: bash -c "while ! nc -w 1 -z db 5432; do sleep 0.1; done; ./manage.py migrate; while :; do ./manage.py runserver_plus 0.0.0.0:8000; sleep 1; done"
image: django
build: .
volumes:
- .:/code
depends_on:
- db
environment:
IN_DOCKER: 1
webserver:
image: jumanjiman/caddy
depends_on:
- web
ports:
- "80:8000"
command: -port 8000 -host 0.0.0.0 "proxy / web:8000 { }"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment