version: '2'  
services:  
  nginx:
    image: nginx:latest
    container_name: nx01
    ports:
      - "8001:8001"
    volumes:
      - ../src:/src
      - ./static:/static
      - ./media:/media/
      - ./config/nginx:/etc/nginx/conf.d
    depends_on:
      - web
  web:
    build: .
    container_name: dg01
    command: gunicorn mydjango.wsgi 0.0.0.0:8000

    depends_on:
      - db
    links:
      - redis
    volumes:
      - ../src:/src
      - ./static:/static
      - ./media:/media/
    expose:
      - "8001"
  db:
    image: postgres:latest
    container_name: pq01
    ports:
     - "5432:5432"

  redis:
    image: redis:latest
    container_name: rd01
    ports:
     - '6379:6379'

  celery:
    build: .
    container_name: cl01
    command: celery worker --app=app.tasks
    volumes:
      - ..:/src
    links:
      - db
      - redis