From 45bbd27f39f36f6ebf84e6b4de87a8e3b695158f Mon Sep 17 00:00:00 2001 From: Aaron Eikenberry Date: Wed, 2 Mar 2016 22:16:25 -0600 Subject: [PATCH] updates docker-compose format to version 2 #483 --- {{cookiecutter.repo_name}}/dev.yml | 37 ++++---- {{cookiecutter.repo_name}}/docker-compose.yml | 92 +++++++++++-------- 2 files changed, 74 insertions(+), 55 deletions(-) diff --git a/{{cookiecutter.repo_name}}/dev.yml b/{{cookiecutter.repo_name}}/dev.yml index d018f7cd..29b2a9ff 100644 --- a/{{cookiecutter.repo_name}}/dev.yml +++ b/{{cookiecutter.repo_name}}/dev.yml @@ -1,17 +1,22 @@ -postgres: - image: postgres:9.5 - volumes: - # If you are using boot2docker, postgres data has to live in the VM for now until #581 is fixed - # for more info see here: https://github.com/boot2docker/boot2docker/issues/581 - - /data/dev/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data +version: '2' +services: + postgres: + image: postgres:9.5 + volumes: + # If you are using boot2docker, postgres data has to live in the VM for now until #581 is fixed + # for more info see here: https://github.com/boot2docker/boot2docker/issues/581 + - /data/dev/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data -django: - dockerfile: Dockerfile-dev - build: . - command: python /app/manage.py runserver_plus 0.0.0.0:8000 - volumes: - - .:/app - ports: - - "8000:8000" - links: - - postgres + django: + build: + context: . + dockerfile: Dockerfile-dev + command: python /app/manage.py runserver_plus 0.0.0.0:8000 + depends_on: + - postgres + volumes: + - .:/app + ports: + - "8000:8000" + links: + - postgres diff --git a/{{cookiecutter.repo_name}}/docker-compose.yml b/{{cookiecutter.repo_name}}/docker-compose.yml index dc681037..13b65e66 100644 --- a/{{cookiecutter.repo_name}}/docker-compose.yml +++ b/{{cookiecutter.repo_name}}/docker-compose.yml @@ -1,43 +1,57 @@ -postgres: - image: postgres:9.5 - volumes: - - /data/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data - env_file: .env +version: '2' +services: + postgres: + image: postgres:9.5 + volumes: + - /data/{{cookiecutter.repo_name}}/postgres:/var/lib/postgresql/data + env_file: .env -django: - build: . - user: django - links: - - postgres - - redis - command: /gunicorn.sh - env_file: .env + django: + build: + context: . + user: django + links: + - postgres + - redis + command: /gunicorn.sh + env_file: .env + depends_on: + - postgres + - redis -nginx: - build: ./compose/nginx - links: - - django - ports: - - "0.0.0.0:80:80" + nginx: + build: ./compose/nginx + links: + - django + ports: + - "0.0.0.0:80:80" -redis: - image: redis:3.0 -{% if cookiecutter.use_celery == 'y' %} -celeryworker: - build: . - user: django - env_file: .env - links: - - postgres - - redis - command: celery -A {{cookiecutter.repo_name}}.taskapp worker -l INFO + redis: + image: redis:3.0 + {% if cookiecutter.use_celery == 'y' %} + celeryworker: + build: + context: . + user: django + env_file: .env + links: + - postgres + - redis + command: celery -A {{cookiecutter.repo_name}}.taskapp worker -l INFO + depends_on: + - postgres + - redis -celerybeat: - build: . - user: django - env_file: .env - links: - - postgres - - redis - command: celery -A {{cookiecutter.repo_name}}.taskapp beat -l INFO -{% endif %} + celerybeat: + build: + context: . + user: django + env_file: .env + links: + - postgres + - redis + command: celery -A {{cookiecutter.repo_name}}.taskapp beat -l INFO + depends_on: + - postgres + - redis + {% endif %}