version: '2'
volumes:
  dbvolume:
services:
  db:
    image: postgres:9.4
    env_file:
      - .env
    volumes:
      - dbvolume:/var/lib/postgresql/data/
  redis:
    image: redis
  web:
    build: .
    ports:
      - 8000:8000
    env_file:
      - .env
    volumes:
      - .:/code
      - /static/
    command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
    depends_on:
      - db
      - redis
  celery:
    build: .
    env_file:
      - .env
    volumes_from:
      - web
    command: celery worker -A freesound_datasets --concurrency=${CELERY_CONCURRENCY}
    depends_on:
      - db
      - redis

version: '2'
volumes:
  dbvolume:
services:
  db:
    image: postgres:9.4
    env_file:
      - .env
    volumes:
      - dbvolume:/var/lib/postgresql/data/
  redis:
    image: redis
  web:
    build: .
    ports:
      - 8000:8000
    env_file:
      - .env
    volumes:
      - .:/code
      - /static/
    command: dumb-init python manage.py runserver 0.0.0.0:8000
    depends_on:
      - db
      - redis
  celery:
    build: .
    env_file:
      - .env
    volumes_from:
      - web
    command: celery worker -A freesound_datasets --concurrency=${CELERY_CONCURRENCY}
    depends_on:
      - db
      - redis

Use dumb-init in web runner to catch SIGTERM
Use dumb-init in web runner to catch SIGTERM

Docker sends SIGTERM to quit a process, but python responds
only to SIGINT, so it waits for 10 seconds before docker
sends SIGKILL and actually stops the process.
dumb-init correctly sends SIGINT to python when it gets given
SIGTERM, so stopping `docker-compose up` with ^C is faster
