version: '3.9'

services:
  caddy:
    image: caddy:2.7.6
    volumes:
      - caddy_config:/etc/caddy
      - caddy_data:/data
    networks:
      - traefik-public
    deploy:
      labels:
        - traefik.enable=true
        - traefik.http.routers.caddy.rule=Host(`caddy.localhost`)
        - traefik.http.routers.caddy.entrypoints=websecure
        - traefik.http.routers.caddy.tls=true
        - traefik.http.services.caddy.loadbalancer.server.port=80

volumes:
  caddy_config:
    driver: local
    driver_opts:
      type: nfs
      o: addr=omv800.local,nolock,soft,rw
      device: :/export/caddy/config
  caddy_data:
    driver: local

networks:
  traefik-public:
    external: true
