From 074d9978a454b128fc7fd95f07490d8239cf4b8b Mon Sep 17 00:00:00 2001 From: Alex Ellis Date: Thu, 16 Mar 2023 11:52:53 +0000 Subject: [PATCH] Update Dockerfile Signed-off-by: Alex Ellis --- Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59991bd..19852b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.18-alpine as builder +FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine as builder ARG TARGETPLATFORM ARG BUILDPLATFORM @@ -18,10 +18,8 @@ COPY go.mod . RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go test -mod=vendor $(go list ./... | grep -v /vendor/) -cover -# add user in this stage because it cannot be done in next stage which is built from scratch -# in next stage we'll copy user and group information from this stage -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -mod=vendor -ldflags "-s -w -X main.GitCommit=${GitCommit} -X main.Version=${Version}" -a -installsuffix cgo -o /usr/bin/license-check \ - && addgroup -S app \ +RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -mod=vendor -ldflags "-s -w -X main.GitCommit=${GitCommit} -X main.Version=${Version}" -o /usr/bin/license-check +RUN addgroup -S app \ && adduser -S -g app app FROM scratch