forked from IBM/operator-for-redis-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.node
48 lines (39 loc) · 1.37 KB
/
Dockerfile.node
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
46
47
48
ARG REDIS_VERSION=6.2.7
ARG BUILDIMAGE=golang:1.19-bullseye
ARG BASEIMAGE=redis:${REDIS_VERSION}-bullseye
ARG DOCKER_PROXY_REGISTRY
FROM ${DOCKER_PROXY_REGISTRY}${BUILDIMAGE} AS builder
ARG GOPROXY=direct
ARG REDIS_VERSION
ARG OPERATOR_VERSION
ARG BUILDTIME
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/node/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.REDIS_VERSION=$REDIS_VERSION \
-X github.com/IBM/operator-for-redis-cluster/pkg/utils.REVISION=$REVISION" \
-a \
-o node \
.
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/node /
ENTRYPOINT ["/node"]