From eaa2be89e620392ced5ee1f139459cc47ace90d9 Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Thu, 11 Feb 2021 16:17:11 -0300 Subject: [PATCH] Change images to scratch (#41) * Change interceptor image to scratch Signed-off-by: Lucas Santos * Update scaler to scratch image Signed-off-by: Lucas Santos --- interceptor/Dockerfile | 12 ++++++------ scaler/Dockerfile | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/interceptor/Dockerfile b/interceptor/Dockerfile index 2289bdc..4db3897 100644 --- a/interceptor/Dockerfile +++ b/interceptor/Dockerfile @@ -1,4 +1,4 @@ -# adapted from Athens +# adapted from Athens # https://github.com/gomods/athens/blob/main/cmd/proxy/Dockerfile ARG GOLANG_VERSION=1.14 ARG ALPINE_VERSION=3.11.5 @@ -18,10 +18,10 @@ ENV CGO_ENABLED=0 ENV GOPROXY="https://proxy.golang.org" RUN go build -o /bin/interceptor ./interceptor -FROM alpine:${ALPINE_VERSION} - -COPY --from=builder /bin/interceptor /bin/interceptor - +FROM gcr.io/distroless/static:nonroot +WORKDIR / +COPY --from=builder /bin/interceptor . +USER nonroot:nonroot EXPOSE 8080 -ENTRYPOINT ["/bin/interceptor"] +ENTRYPOINT ["/interceptor"] diff --git a/scaler/Dockerfile b/scaler/Dockerfile index 458c95c..3bec40f 100644 --- a/scaler/Dockerfile +++ b/scaler/Dockerfile @@ -1,4 +1,4 @@ -# taken from Athens +# taken from Athens # https://github.com/gomods/athens/blob/main/cmd/proxy/Dockerfile ARG GOLANG_VERSION=1.14 ARG ALPINE_VERSION=3.11.5 @@ -18,10 +18,10 @@ ENV CGO_ENABLED=0 ENV GOPROXY="https://proxy.golang.org" RUN go build -o /bin/scaler ./scaler -FROM alpine:${ALPINE_VERSION} - -COPY --from=builder /bin/scaler /bin/scaler - +FROM gcr.io/distroless/static:nonroot +WORKDIR / +COPY --from=builder /bin/scaler . +USER nonroot:nonroot EXPOSE 8080 -ENTRYPOINT ["/bin/scaler"] +ENTRYPOINT ["/scaler"]