# Build CoreDNS from source FROM golang:latest AS builder RUN apt-get update && apt-get install -y git make && rm -rf /var/lib/apt/lists/* WORKDIR /build RUN git clone --depth 1 https://github.com/coredns/coredns.git . # Build static binary RUN CGO_ENABLED=0 make # Runtime image FROM ubuntu:latest RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* COPY --from=builder /build/coredns /usr/local/bin/coredns COPY Corefile /etc/coredns/Corefile EXPOSE 53/udp 53/tcp ENTRYPOINT ["/usr/local/bin/coredns"] CMD ["-conf", "/etc/coredns/Corefile"]