-
Notifications
You must be signed in to change notification settings - Fork 47
/
Dockerfile
53 lines (44 loc) · 2.28 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
# Build the manager binary
FROM golang:1.23.3 AS builder
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 version/ version/
# Build the operator
# TARGETARCH, TARGETOS are automatically set by docker.
# see: https://sdk.operatorframework.io/docs/advanced-topics/multi-arch/#manifest-lists
# see: https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH GO111MODULE=on go build -a -o manager cmd/main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
LABEL org.opencontainers.image.documentation="https://github.com/konpyutaika/nifikop/blob/master/README.md"
LABEL org.opencontainers.image.authors="Alexandre Guitton <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/konpyutaika/nifikop"
LABEL org.opencontainers.image.vendor="Konpyūtāika"
LABEL org.opencontainers.image.version="0.1"
LABEL org.opencontainers.image.description="NiFi cluster operator"
LABEL org.opencontainers.image.url="https://github.com/konpyutaika/nifikop"
LABEL org.opencontainers.image.title="NiFi operator"
LABEL org.label-schema.usage="https://github.com/konpyutaika/nifikop/blob/master/README.md"
LABEL org.label-schema.docker.cmd="/usr/local/bin/nifikop"
LABEL org.label-schema.docker.cmd.devel="N/A"
LABEL org.label-schema.docker.cmd.test="N/A"
LABEL org.label-schema.docker.cmd.help="N/A"
LABEL org.label-schema.docker.cmd.debug="N/A"
LABEL org.label-schema.docker.params="LOG_LEVEL=define loglevel,LOG_ENCODING=define logEncoding,RESYNC_PERIOD=period in second to execute resynchronisation,WATCH_NAMESPACE=namespace to watch for nificlusters,OPERATOR_NAME=name of the operator instance pod"
WORKDIR /
COPY --from=builder /workspace/manager .
#USER 65532:65532
USER 1001:1001
ENTRYPOINT ["/manager"]