version: '3'

volumes:
  benchcoach_local_postgres_data: {}
  benchcoach_local_postgres_data_backups: {}

services:
  django:
    build:
      context: .
      dockerfile: ./compose/local/django/Dockerfile
    image: benchcoach_local_django
    container_name: benchcoach_local_django
    platform: linux/x86_64
    depends_on:
      - postgres
    volumes:
      - /volume1/docker/benchcoach_nas:/app:z
    env_file:
      - ./.envs/.local/.django
      - ./.envs/.local/.postgres
    ports:
      - "8000:8000"
    command: /start

  postgres:
    build:
      context: .
      dockerfile: ./compose/production/postgres/Dockerfile
    image: benchcoach_production_postgres
    container_name: benchcoach_local_postgres
    volumes:
      - benchcoach_local_postgres_data:/var/lib/postgresql/data:Z
      - benchcoach_local_postgres_data_backups:/backups:z
    env_file:
      - ./.envs/.local/.postgres

  docs:
    image: benchcoach_local_docs
    container_name: benchcoach_local_docs
    platform: linux/x86_64
    build:
      context: .
      dockerfile: ./compose/local/docs/Dockerfile
    env_file:
      - ./.envs/.local/.django
    volumes:
      - /volume1/docker/benchcoach_nas/docs:/docs:z
      - /volume1/docker/benchcoach_nas/config:/app/config:z
      - /volume1/docker/benchcoach_nas/benchcoach:/app/benchcoach:z
    ports:
      - "9000:9000"
    command: /start-docs

  nginx-proxy:
    image: jwilder/nginx-proxy:alpine
    container_name: nginx-proxy
    ports:
      - "8001:80"
      - "8002:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - /volume1/docker/benchcoach_nas/certs:/etc/nginx/certs
    restart: always
    depends_on:
      - django
