version: '3.7'

services:
  web:
    build: ./app
    volumes:
      - ./app/:/usr/src/app/
      - ./input_volume/:/usr/src/app/input_data
      - ./static_volume:/usr/src/app/staticfiles
    expose:
      - 8000
    env_file: .env
    depends_on:
      - db
    command: bash -c /wait-for-it/wait-for-it.sh db:5432 --strict --timeout=0
  db:
    env_file: .env
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_DB_NAME: ${POSTGRES_DB_NAME}
    expose:
      - 5432
    image: postgres:11.2
    volumes:
      - ./postgres_data:/var/lib/postgresql/data/
  nginx:
    build: ./nginx
    volumes:
      - ./static_volume:/usr/src/app/staticfiles
    ports:
      - 8000:80
    depends_on:
      - web