Last active
September 21, 2019 12:35
-
-
Save danielloader/754093de4de6baad82f5eb749368dbfc to your computer and use it in GitHub Desktop.
docker-compose.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
traefik: | |
image: traefik | |
ports: | |
- 80:80 | |
- 8080:8080 # optional for the status board, don't expose to internet | |
- 443:443 | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./config/traefik/traefik.toml:/etc/traefik/traefik.toml:ro | |
- cert-storage:/etc/traefik/acme | |
networks: | |
- public | |
static: | |
image: nginx:alpine | |
container_name: nginx_static_files | |
restart: unless-stopped | |
volumes: | |
- web-static:/www/static | |
- ./config/nginx/conf.d:/etc/nginx/conf.d | |
depends_on: | |
- traefik | |
labels: | |
- "traefik.enable=true" | |
- "traefik.backend=nginx" | |
- "traefik.frontend.rule=Host:xyz.co;PathPrefix:/static" | |
- "traefik.port=80" | |
web: | |
restart: unless-stopped | |
container_name: django_application | |
build: ./web | |
volumes: | |
- web-django:/usr/src/app | |
- web-static:/usr/src/app/static | |
environment: | |
DEBUG: 'true' # optional for bootstrapping django | |
command: /usr/local/bin/gunicorn main.wsgi:application -w 2 -b :8000 | |
depends_on: | |
- postgres | |
- traefik | |
labels: | |
- "traefik.enable=true" | |
- "traefik.backend=web" | |
- "traefik.frontend.rule=Host:xyz.co;" | |
- "traefik.port=8000" | |
networks: | |
- internal: | |
- django | |
postgres: | |
restart: unless-stopped | |
image: postgres:latest | |
expose: | |
- "5432" | |
# environmental file with database credentials | |
env_file: | |
- config/db/postgre_env | |
volumes: | |
- db-data:/var/lib/postgresql/data/ | |
networks: | |
- internal: | |
- db | |
networks: | |
public: | |
driver: bridge | |
internal: | |
driver: bridge | |
volumes: | |
web-django: | |
web-static: | |
db-data: | |
cert-storage: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment