-
Notifications
You must be signed in to change notification settings - Fork 31
/
Dockerfile
23 lines (17 loc) · 899 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##################### builder #####################
FROM golang:1.22 AS builder
ENV GO111MODULE=on
WORKDIR /go/src/github.com/gardener/gardener-metrics-exporter
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-o /go/bin/gardener-metrics-exporter \
-ldflags="-s -w \
-X github.com/gardener/gardener-metrics-exporter/pkg/version.gitVersion=$(cat VERSION) \
-X github.com/gardener/gardener-metrics-exporter/pkg/version.gitCommit=$(git rev-parse --verify HEAD) \
-X github.com/gardener/gardener-metrics-exporter/pkg/version.buildDate=$(date --rfc-3339=seconds | sed 's/ /T/')" \
cmd/main.go
############# gardener-metrics-exporter #############
FROM gcr.io/distroless/static-debian12:nonroot AS metrics-exporter
COPY --from=builder /go/bin/gardener-metrics-exporter /gardener-metrics-exporter
WORKDIR /
ENTRYPOINT ["/gardener-metrics-exporter"]