version: '2.3'

services:
  site:
    build:
      context: .
      target: dev
    volumes:
      - "./:/service"
    env_file: bootstrap/site_env
    environment:
      - DATABASE_URL=postgresql://postgres@postgres:5432
      - REDIS_URL=redis://redis
      - ENFORCE_PRODUCTION=False

      # Debug option to relax many of the volunteer limits.
      #- DBG_VOLUNTEER_PERMISSIVE=True
    links:
      - "redis"
      - "postgres"
    depends_on:
      - redis
      - postgres

  redis:
    image: redis
    ports:
      - "6379:6379"

  postgres:
    image: postgres:12.14
    # command: ["postgres", "-c", "log_statement=all"]
    # uncomment this if u wanna output all SQL queries to the console
    volumes:
      - "./bootstrap/original-schema.sql:/docker-entrypoint-initdb.d/00-schema.sql"
      - "./bootstrap/original-seed-db.sql:/docker-entrypoint-initdb.d/10-seed-db.sql"
      # uncomment this if you want to explicitly set a DB
      #- "./postgres_db:/var/lib/postgresql/data"
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust
    ports:
      - "5432:5432"

  nginx:
    image: nginx:latest
    ports:
      - "80:80"
    volumes:
      - ./bootstrap/nginx_dev.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - site
    