-
Notifications
You must be signed in to change notification settings - Fork 37
/
Dockerfile
64 lines (48 loc) · 1.62 KB
/
Dockerfile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.22 AS builder
# OS and Arch args
ARG TARGETOS
ARG TARGETARCH
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY cmd/main.go cmd/main.go
COPY api/ api/
COPY internal/controller/ internal/controller/
COPY pkg/ pkg/
COPY errors/ errors/
# Build
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o manager cmd/main.go
# Base image
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
# Version of Operator (build arg)
ARG VERSION="3.4.0"
# User to run container as
ARG USER="root"
# Maintainer
LABEL maintainer="Aerospike <support@aerospike.com>"
# Labels
LABEL name="aerospike-kubernetes-operator" \
vendor="Aerospike" \
version="${VERSION}" \
release="1" \
summary="Aerospike Kubernetes Operator" \
description="The Aerospike Kubernetes Operator automates the deployment and management of Aerospike enterprise clusters on Kubernetes" \
io.k8s.display-name="Aerospike Kubernetes Operator v${VERSION}" \
io.k8s.description="Aerospike Kubernetes Operator"
# Labels for RedHat Openshift platform
LABEL io.openshift.tags="database,nosql,aerospike" \
io.openshift.non-scalable="false"
# License file
COPY LICENSE /licenses/
WORKDIR /
COPY --from=builder /workspace/manager .
RUN chgrp 0 /manager \
&& chmod g=u /manager
USER ${USER}
ENTRYPOINT ["/manager"]