version: "3"

# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
  pihole:
    container_name: pihole
    networks:
      - traefik
    image: pihole/pihole:latest
    # For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
    ports:
      - "5353:53/tcp"
      - "5354:53/udp"
      # - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
      - "8108:80/tcp"
    environment:
      TZ: 'Europe/Copenhagen'
      WEBPASSWORD: '4REXogCS3JouQATJKrnRy'
    # Volumes store your data between container upgrades
    volumes:
      - '/srv/pihole/piho:/etc/pihole'
      - '/srv/pihole/dnsmasq.d:/etc/dnsmasq.d'    
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN # Recommended but not required (DHCP needs NET_ADMIN)      
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.pihole.entrypoints=websecure"
      - "traefik.http.routers.pihole.rule=Host(`pihole.$DOMAIN_NAME`)"
      - "traefik.http.routers.pihole.tls.certresolver=letsencr"
      - "traefik.http.services.pihole.loadbalancer.server.port=5353"
networks:
  traefik:
    external: true
