services:
  web:
    build:
      context: .
      args:
        VITE_SUPABASE_URL: ${VITE_SUPABASE_URL}
        VITE_SUPABASE_ANON_KEY: ${VITE_SUPABASE_ANON_KEY}
        VITE_TG_BOT_TOKEN: ${VITE_TG_BOT_TOKEN}
        VITE_TG_CHAT_ID: ${VITE_TG_CHAT_ID}
        VITE_VAPID_PUBLIC_KEY: ${VITE_VAPID_PUBLIC_KEY}
    environment:
      DOMAIN: ${DOMAIN:-localhost}
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"   # HTTP/3
    volumes:
      - caddy_data:/data       # TLS certificates (persisted across restarts)
      - caddy_config:/config   # Caddy config cache
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://localhost:80"]
      interval: 30s
      timeout: 5s
      retries: 3

volumes:
  caddy_data:
  caddy_config:
