forked from IBM/operator-for-redis-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.metrics
45 lines (36 loc) · 1.24 KB
/
Dockerfile.metrics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
ARG BUILDIMAGE=golang:1.19-bullseye
ARG BASEIMAGE=debian:bullseye-slim
ARG DOCKER_PROXY_REGISTRY
FROM ${DOCKER_PROXY_REGISTRY}${BUILDIMAGE} AS builder
ARG GOPROXY=direct
ARG BUILDTIME
ARG OPERATOR_VERSION
ARG REVISION
ENV DEBIAN_FRONTEND=noninteractive
ENV INSTALL_DIRECTORY=/usr/local/bin
ENV GOPROXY=https://proxy.golang.org
WORKDIR /go/src/operator-for-redis-cluster
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ cmd/
COPY api/ api/
COPY pkg/ pkg/
COPY cmd/metrics/main.go ./
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build \
-ldflags "-w -s \
-X github.com/IBM/operator-for-redis-cluster/pkg/utils.BUILDTIME=$BUILDTIME \
-X github.com/IBM/operator-for-redis-cluster/pkg/utils.OPERATOR_VERSION=$OPERATOR_VERSION \
-X github.com/IBM/operator-for-redis-cluster/pkg/utils.REVISION=$REVISION" \
-a \
-o metrics \
.
FROM ${DOCKER_PROXY_REGISTRY}${BASEIMAGE}
LABEL maintainer="William Cassanova <[email protected]>, Tomash Sidei <[email protected]>, Kenny Scharm <[email protected]>"
COPY --from=builder /go/src/operator-for-redis-cluster/metrics /
ENTRYPOINT ["/metrics"]