# this stage prepares the configuration files in /etc/powerdns FROM debian:trixie-slim AS builder ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends make WORKDIR /etc/powerdns RUN mkdir -p pdns.d COPY pdns.conf pdns.conf # build some config files from templates COPY zones pri COPY secondary tpl COPY secondary/Makefile . RUN make RUN rm -rf tpl pri Makefile # this stage is the actual secondary DNS server image FROM debian:trixie-slim # install make for building config files, pdns-server and bind backend for serving zones ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ pdns-server pdns-backend-bind pdns-backend-sqlite3 \ && rm -rf /var/lib/apt/lists/* # install configuration files, create necessary directories WORKDIR /etc/powerdns RUN rm -rf * COPY --from=builder /etc/powerdns . RUN mkdir -p db sec /var/run/pdns # user permissions RUN chown pdns db sec /var/run/pdns USER pdns # DNSSEC setup RUN pdnsutil create-bind-db /etc/powerdns/db/bind-dnssec-db.sqlite3 CMD ["pdns_server", "--guardian=no", "--daemon=no", "--loglevel=10", "--webserver=no"]