Run coredns as non root. (#5969)
Signed-off-by: Vinayak Goyal <vinaygo@google.com>
This commit is contained in:
parent
1258e3b2f2
commit
d21537f931
1 changed files with 8 additions and 7 deletions
15
Dockerfile
15
Dockerfile
|
@ -1,4 +1,4 @@
|
|||
FROM --platform=$BUILDPLATFORM debian:stable-slim
|
||||
FROM --platform=$BUILDPLATFORM debian:stable-slim AS build
|
||||
SHELL [ "/bin/sh", "-ec" ]
|
||||
|
||||
RUN export DEBCONF_NONINTERACTIVE_SEEN=true \
|
||||
|
@ -7,13 +7,14 @@ RUN export DEBCONF_NONINTERACTIVE_SEEN=true \
|
|||
TERM=linux ; \
|
||||
apt-get -qq update ; \
|
||||
apt-get -yyqq upgrade ; \
|
||||
apt-get -yyqq install ca-certificates ; \
|
||||
apt-get -yyqq install ca-certificates libcap2-bin; \
|
||||
apt-get clean
|
||||
COPY coredns /coredns
|
||||
RUN setcap cap_net_bind_service=+ep /coredns
|
||||
|
||||
FROM --platform=$TARGETPLATFORM scratch
|
||||
|
||||
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
ADD coredns /coredns
|
||||
|
||||
FROM --platform=$TARGETPLATFORM gcr.io/distroless/static-debian11:nonroot
|
||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=build /coredns /coredns
|
||||
USER nonroot:nonroot
|
||||
EXPOSE 53 53/udp
|
||||
ENTRYPOINT ["/coredns"]
|
||||
|
|
Loading…
Add table
Reference in a new issue