version: '3'

volumes:
  db_data:

services:
  db:
    image: postgres
    environment:
      - "POSTGRES_DB=${POSTGRES_DB}"
      - "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
    volumes:
      - db_data:/var/lib/postgresql/data/

  web:
    build: .
    command: ./run.sh
    volumes:
      - .:/code
    ports:
      - 8000:8000
    environment:
      - "DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE}"
      - "DJANGO_DEBUG=${DJANGO_DEBUG}"
      - "DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}"
    depends_on:
      - db

  nginx:
    build: ./nginx
    ports:
      - 80:80
    depends_on:
      - web
    volumes:
      - ./network_inventory/static:/home/app/web/static
