version: '3'

volumes:
  benchcoach_local_postgres_data: {}
  benchcoach_local_postgres_data_backups: {}
  certs: {}
  vhost: {}
  html: {}
  acme: {}

services:
  django:
    build:
      context: .
      dockerfile: ./compose/linode/django/Dockerfile
    image: benchcoach_local_django
    container_name: benchcoach_local_django
    platform: linux/x86_64
    depends_on:
      - postgres
    volumes:
      - /root/teamsnap-benchcoach:/app:z
    env_file:
      - ./.envs/.linode/.django
      - ./.envs/.linode/.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/.linode/.postgres

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

  nginx-proxy:
    image: jwilder/nginx-proxy:alpine
    container_name: nginx-proxy
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - certs:/etc/nginx/certs
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
    env_file:
      - ./.envs/.linode/.nginx-proxy
    restart: always
    depends_on:
      - django

  nginx-proxy-acme:
    image: nginxproxy/acme-companion
    container_name: nginx-proxy-acme
    volumes_from:
      - nginx-proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - certs:/etc/nginx/certs:rw
      - acme:/etc/acme.sh
    env_file:
      - ./.envs/.linode/.nginx-proxy-acme
