version: "3"

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    networks:
      - proxy
    ports:
      - "53:53/tcp"
      - "53:53/udp"
    environment:
      TZ: 'Europe/Paris'
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    labels:
      - "traefik.enable=true"
      - "traefik.http.middlewares.pihole-auth.basicauth.users=mrdev023:$$2y$$05$$t51tXUW6zO9dndSK1JEFS.utJ3th/RYVSgDlouOZhUigjbkTX1zQC$$"
      - "traefik.http.routers.pihole-secure.entrypoints=https"
      - "traefik.http.routers.pihole-secure.rule=Host(`pihole.mrdev023.fr`)"
      - "traefik.http.routers.pihole-secure.middlewares=pihole-auth"
      - "traefik.http.routers.pihole-secure.tls=true"
      - "traefik.http.routers.pihole-secure.tls.certresolver=http"
      - "traefik.docker.network=proxy"
    restart: always

networks:
  proxy:
    external: true
