From bc2466520a92e9603f8be1dd486c6d5bbd77468a Mon Sep 17 00:00:00 2001 From: JenTing Hsiao Date: Mon, 18 Nov 2024 19:39:49 +0800 Subject: [PATCH] enhance: change to distroless base image Signed-off-by: JenTing Hsiao --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f5da096..0292390 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,11 @@ -FROM golang:1.23.2 as builder +FROM golang:1.23.2 AS builder WORKDIR /workspace COPY go.mod go.sum /workspace/ RUN go mod download COPY . . RUN CGO_ENABLED=0 go build -a -o manager main.go -FROM alpine:3.20.3 -RUN apk update && apk add --no-cache ca-certificates +FROM gcr.io/distroless/static:nonroot WORKDIR / COPY --from=builder /workspace/manager . USER nobody