services:
  caddy:
    image: custom-caddy:2.9.1-rr1
    container_name: caddy
    build:
      context: .
      dockerfile: Dockerfile.caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    networks:
      - bizmatch
      - keycloak
      - gitea
      - mail_network
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/email_autodiscover:/etc/caddy/email_autodiscover
      - caddy_data:/data
      - caddy_config:/config
      - /home/aknuth/git/bizmatch-project/bizmatch/dist/bizmatch/browser:/home/aknuth/git/bizmatch-project/bizmatch/dist/bizmatch/browser
      - /home/aknuth/git/bizmatch-project-prod/bizmatch/dist/bizmatch/browser:/home/aknuth/git/bizmatch-project-prod/bizmatch/dist/bizmatch/browser
      - /home/aknuth/git/bizmatch-project/bizmatch-server/pictures:/home/aknuth/git/bizmatch-project/bizmatch-server/pictures
      - /home/aknuth/git/bizmatch-project-prod/bizmatch-server/pictures:/home/aknuth/git/bizmatch-project-prod/bizmatch-server/pictures
      - /home/aknuth/git/annaville-sda-site/dist:/home/aknuth/git/annaville-sda-site/dist:ro  # ← DAS FEHLT!
      - /home/aknuth/git/bay-area-affiliates/dist/bay-area-affiliates/browser:/app
      - /home/aknuth/log/caddy:/var/log/caddy
      - /home/aknuth/git/config-email/frontend/dist:/home/aknuth/git/config-email/frontend/dist:ro
    environment:
      - CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
      - CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}

networks:
  bizmatch:
    external: true
  keycloak:
    external: true
  gitea:
    external: true
  mail_network:
    external: true

volumes:
  caddy_data:
    external: true
  caddy_config:
