From 72500cec493f3f8cd19474518326eacd2c02e318 Mon Sep 17 00:00:00 2001 From: Vilmos Martinek Date: Mon, 28 Oct 2024 15:27:15 +0100 Subject: [PATCH] change base image to distroless/static Signed-off-by: Vilmos Martinek --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 64e579e..36b633a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS build WORKDIR /fn # Most functions don't want or need CGo support, so we disable it. +# If CGo support is needed make sure to also change the base image to one that +# includes glibc, like 'distroless/base'. ENV CGO_ENABLED=0 # We run go mod download in a separate step so that we can cache its results. @@ -38,7 +40,7 @@ RUN --mount=target=. \ # Produce the Function image. We use a very lightweight 'distroless' image that # does not include any of the build tools used in previous stages. -FROM gcr.io/distroless/base-debian11 AS image +FROM gcr.io/distroless/static-debian12:nonroot AS image WORKDIR / COPY --from=build /function /function EXPOSE 9443