Skip to content

Commit

Permalink
Update Golang version and replace Alpine with Distroless
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymcconville committed Sep 25, 2024
1 parent 7f31ba9 commit 29b5658
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 29b5658

Please sign in to comment.