services:
  caddy:
    # Custom build with Cloudflare DNS plugin for DNS-01 challenges
    build:
      context: .
      dockerfile: Dockerfile
    container_name: caddy
    restart: unless-stopped
    ports:
      - "80:80"      # HTTP (redirect to HTTPS)
      - "443:443"    # HTTPS
      - "443:443/udp" # HTTP/3 QUIC
    environment:
      CF_API_TOKEN: ${CF_API_TOKEN}
      TZ: America/Chicago
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data      # TLS certs and ACME state
      - caddy_config:/config  # Runtime config (auto-managed)
    networks:
      - caddy_network

networks:
  caddy_network:
    driver: bridge

volumes:
  caddy_data:
  caddy_config:
