services:
  pihole:
    container_name: pihole
    image: docker.io/pihole/pihole:2026.06.0
    restart: unless-stopped
    networks:
      homelab-network:
        ipv4_address: 172.30.0.100
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 2050:80/tcp
    environment:
      - TZ=Africa/Nairobi
      - PIHOLE_DNS_=172.30.0.101#2052
      - PIHOLE_UID=1000
      - PIHOLE_GID=1000
      - FTLCONF_webserver_api_password=${PIHOLE_WEBPASSWORD}
      - FTLCONF_dns_listeningMode=ALL
      - FTLCONF_dns_upstreams=172.30.0.101#2052
    volumes:
      - ~/docker-volumes/pihole:/etc/pihole
      - ~/docker-volumes/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    security_opt:
      - no-new-privileges:true
    depends_on:
      - unbound

  unbound:
    container_name: unbound
    image: docker.io/mvance/unbound:1.22.0
    restart: unless-stopped
    networks:
      homelab-network:
        ipv4_address: 172.30.0.101
    volumes:
      - ./docker-compose/pihole/unbound/unbound.conf:/opt/unbound/etc/unbound/unbound.conf
    ports:
      - 2052:53/tcp
      - 2052:53/udp
    security_opt:
      - no-new-privileges:true

  pihole-exporter:
    container_name: pihole-exporter
    image: docker.io/ekofr/pihole-exporter:v1.2.0
    restart: unless-stopped
    networks:
      homelab-network:
        ipv4_address: 172.30.0.110
    environment:
      - PIHOLE_HOSTNAME=172.30.0.100
      - PIHOLE_PASSWORD=${PIHOLE_WEBPASSWORD}
      - PORT=2051
      - PIHOLE_PORT=80
      - PIHOLE_PROTOCOL=http
      - INTERVAL=30s
    ports:
      - 2051:2051
    security_opt:
      - no-new-privileges:true
