version: "3"

services:
  db:
    image: postgres:13
    env_file:
      - docker.env
    volumes:
      - db_data:/var/lib/postgresql/data/

  vulnerablecode:
    build: .
    command: /bin/sh -c "
        ./manage.py migrate &&
        ./manage.py collectstatic --no-input --verbosity 0 --clear &&
        gunicorn vulnerablecode.wsgi:application -u nobody -g nogroup --bind :8000 --timeout 600 --workers 8"
    env_file:
      - docker.env
    expose:
      - 8000
    volumes:
      - /etc/vulnerablecode/:/etc/vulnerablecode/
      - static:/var/vulnerablecode/static/
    depends_on:
      - db

  nginx:
    image: nginx
    ports:
      - 80:80
      - 443:443
    env_file:
      - docker.env
    volumes:
      - ./etc/nginx/conf.d/:/etc/nginx/conf.d/
      - static:/var/vulnerablecode/static/
    depends_on:
      - vulnerablecode


volumes:
  db_data:
  static:

