version: '3'
services:
  db:
    image: postgres
    env_file: d4s2.env
    volumes:
      - postgres_data:/var/lib/postgresql/data
  web:
    build: .
    env_file: d4s2.env
    ports:
      - "8000:8000"
    depends_on:
      - db
    entrypoint:
      - /usr/src/app/d4s2/wait-for-postgres.sh
      - db
    # docker-compose doesn't allow specifying the entrypoint while preserving
    # the Dockerfile's command
    command: python manage.py runserver 0.0.0.0:8000
  tasks:
    build: .
    env_file: d4s2.env
    depends_on:
      - db
    entrypoint:
      - /usr/src/app/d4s2/wait-for-postgres.sh
      - db
    # docker-compose doesn't allow specifying the entrypoint while preserving
    # the Dockerfile's command
    command: python manage.py process_tasks
volumes:
  postgres_data:

version: '3'
services:
  db:
    image: postgres
    env_file: d4s2.env
    volumes:
      - postgres_data:/var/lib/postgresql/data
  web:
    build: .
    env_file: d4s2.env
    ports:
      - "8000:8000"
    depends_on:
      - db
    entrypoint:
      - /usr/src/app/d4s2/wait-for-postgres.sh
      - db
    # docker-compose doesn't allow specifying the entrypoint while preserving
    # the Dockerfile's command
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/usr/src/app
      - ./d4s2/settings.docker:/usr/src/app/d4s2/settings.py
  tasks:
    build: .
    env_file: d4s2.env
    depends_on:
      - db
    entrypoint:
      - /usr/src/app/d4s2/wait-for-postgres.sh
      - db
    # docker-compose doesn't allow specifying the entrypoint while preserving
    # the Dockerfile's command
    command: python manage.py process_tasks
    volumes:
      - .:/usr/src/app
      - ./d4s2/settings.docker:/usr/src/app/d4s2/settings.py
volumes:
  postgres_data:

Add volumes for local development
Add volumes for local development
