services:
  dozzle:
    container_name: dozzle
    image: amir20/dozzle:v8.14.6
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    networks:
      - app
    environment:
      DOZZLE_AUTH_PROVIDER: forward-proxy
    deploy:
      mode: global
    healthcheck:
      test: ["CMD", "/dozzle", "healthcheck"]
      interval: 3s
      timeout: 30s
      retries: 5
      start_period: 30s
    labels:
      dev.dozzle.group: PaaS
  caddy:
    container_name: caddy
    pull_policy: build
    build:
      context: ../..
      dockerfile: containers/paas/Containerfile
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - app
      - wan
    environment:
      HOSTNAME: ${HOSTNAME}
      CADDY_OAUTH_CLIENT_ID: ${CADDY_OAUTH_CLIENT_ID}
      CADDY_OAUTH_CLIENT_SECRET: ${CADDY_OAUTH_CLIENT_SECRET}
    healthcheck:
      test: ["CMD-SHELL", "caddy validate --config /etc/caddy/Caddyfile"]
    deploy:
      mode: global
    labels:
      dev.dozzle.group: PaaS
networks:
  app:
    name: app
    driver: bridge
    internal: true
  wan:
    name: wan
    driver: bridge
volumes:
  caddy_data:
  caddy_config:
