From 29b565806da21599772119e9f302043fc64b7232 Mon Sep 17 00:00:00 2001 From: Henry McConville Date: Wed, 25 Sep 2024 12:36:26 +0100 Subject: [PATCH] Update Golang version and replace Alpine with Distroless --- Dockerfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5c7bf6..226b4a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM golang:1.22-bookworm as build +ARG GOLANG_VERSION=1.22.7 +FROM golang:${GOLANG_VERSION} AS build LABEL maintainer="githubexporter" ENV GO111MODULE=on @@ -10,13 +11,9 @@ RUN go mod download \ && go test ./... \ && CGO_ENABLED=0 GOOS=linux go build -o /bin/main -FROM alpine:3 +FROM gcr.io/distroless/static AS runtime -RUN apk --no-cache add ca-certificates \ - && addgroup exporter \ - && adduser -S -G exporter exporter ADD VERSION . -USER exporter COPY --from=build /bin/main /bin/main ENV LISTEN_PORT=9171 EXPOSE 9171