FROM ubuntu:latest as builder # install the required packages RUN apt-get update && apt-get install -y \ wget \ libunbound-dev \ git \ make \ build-essential # add golang to the builder RUN wget https://golang.org/dl/go1.22.0.linux-amd64.tar.gz && \ tar -C /usr/local -xzf go* && \ ln -s /usr/local/go/bin/go /usr/local/bin && \ rm go* # grab the coredns release WORKDIR /tmp/coredns/ RUN wget https://github.com/coredns/coredns/archive/v1.11.1.tar.gz && \ tar -xzf v* && \ mv core* coredns && \ rm v* # build coredns WORKDIR /tmp/coredns/coredns/ COPY plugin.cfg . RUN CGO_ENABLED=1 make FROM ubuntu:latest COPY --from=builder /tmp/coredns/coredns/coredns /dns/ RUN apt-get update && apt-get install -y libunbound-dev && rm -rf /var/lib/apt/lists/* WORKDIR /dns/ ENTRYPOINT ["./coredns"]