cookiecutter-django/{{cookiecutter.project_slug}}/production.yml
2018-03-08 19:04:10 +03:00

71 lines
1.4 KiB
YAML

version: '2'
volumes:
postgres_data: {}
postgres_backup: {}
caddy: {}
services:
django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %}
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
depends_on:
- postgres
- redis
env_file:
- ./.envs/.production/.django
- ./.envs/.production/.postgres
{%- if cookiecutter.use_celery == 'y' %}
- ./.envs/.production/.celery
{%- endif %}
command: /gunicorn.sh
postgres:
build:
context: .
dockerfile: ./compose/production/postgres/Dockerfile
volumes:
- postgres_data:/var/lib/postgresql/data
- postgres_backup:/backups
env_file:
- ./.envs/.production/.postgres
caddy:
build:
context: .
dockerfile: ./compose/production/caddy/Dockerfile
depends_on:
- django
volumes:
- caddy:/root/.caddy
env_file:
- ./.envs/.production/.caddy
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:443"
redis:
image: redis:3.0
{%- if cookiecutter.use_celery == 'y' %}
celeryworker:
<<: *django
depends_on:
- postgres
- redis
env_file:
- ./.envs/.production/.celery
command: /start-celeryworker.sh
celerybeat:
<<: *django
depends_on:
- postgres
- redis
env_file:
- ./.envs/.production/.celery
command: /start-celerybeat.sh
{%- endif %}