2023-05-26 15:57:25 +02:00
|
|
|
ARG DEBIAN_IMAGE=debian:stable-slim
|
2024-11-13 00:40:01 +01:00
|
|
|
ARG BASE=gcr.io/distroless/static-debian12:nonroot
|
2023-05-26 15:57:25 +02:00
|
|
|
FROM --platform=$BUILDPLATFORM ${DEBIAN_IMAGE} AS build
|
2022-08-15 18:22:08 +03:00
|
|
|
SHELL [ "/bin/sh", "-ec" ]
|
2016-04-13 20:14:13 +01:00
|
|
|
|
2022-08-15 18:22:08 +03:00
|
|
|
RUN export DEBCONF_NONINTERACTIVE_SEEN=true \
|
|
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
|
DEBIAN_PRIORITY=critical \
|
|
|
|
|
TERM=linux ; \
|
|
|
|
|
apt-get -qq update ; \
|
2025-08-05 11:54:18 +12:00
|
|
|
apt-get -qq upgrade ; \
|
|
|
|
|
apt-get -qq --no-install-recommends install ca-certificates libcap2-bin; \
|
2022-08-15 18:22:08 +03:00
|
|
|
apt-get clean
|
2023-03-20 19:49:59 +05:30
|
|
|
COPY coredns /coredns
|
|
|
|
|
RUN setcap cap_net_bind_service=+ep /coredns
|
2016-04-13 20:14:13 +01:00
|
|
|
|
2023-05-26 15:57:25 +02:00
|
|
|
FROM --platform=$TARGETPLATFORM ${BASE}
|
2023-03-20 19:49:59 +05:30
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
|
COPY --from=build /coredns /coredns
|
|
|
|
|
USER nonroot:nonroot
|
2025-08-05 11:54:18 +12:00
|
|
|
# Reset the working directory inherited from the base image back to the expected default:
|
|
|
|
|
# https://github.com/coredns/coredns/issues/7009#issuecomment-3124851608
|
2024-10-01 18:12:19 +02:00
|
|
|
WORKDIR /
|
2016-04-13 20:14:13 +01:00
|
|
|
EXPOSE 53 53/udp
|
|
|
|
|
ENTRYPOINT ["/coredns"]
|