Dockerfile (546B)
1 FROM golang:1.22 AS build-stage 2 3 WORKDIR /app 4 5 COPY go.mod go.sum ./ 6 RUN go mod download 7 8 COPY *.go ./ 9 # Build the Go binary with version information 10 ARG VERSION 11 ARG BRANCH 12 RUN CGO_ENABLED=0 GOOS=linux go build \ 13 -ldflags "-X github.com/prometheus/common/version.Version=${VERSION} -X github.com/prometheus/common/version.Branch=${BRANCH}" \ 14 -o /ping-monitoring 15 16 FROM gcr.io/distroless/base-debian12 17 18 WORKDIR / 19 20 COPY --from=build-stage /ping-monitoring /ping-monitoring 21 22 EXPOSE 8080 23 24 USER nonroot:nonroot 25 26 ENTRYPOINT ["/ping-monitoring"]