forked from humio/humio-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (32 loc) · 1.23 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
# Build the manager binary
FROM golang:1.17 as builder
ARG RELEASE_VERSION=master
ARG RELEASE_COMMIT=none
ARG RELEASE_DATE=unknown
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 main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY pkg/ pkg/
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -ldflags="-s -w -X 'main.version=$RELEASE_VERSION' -X 'main.commit=$RELEASE_COMMIT' -X 'main.date=$RELEASE_DATE'" -a -o manager main.go
# Use ubi8 as base image to package the manager binary to comply with Red Hat image certification requirements
FROM scratch
LABEL "name"="humio-operator"
LABEL "vendor"="humio"
LABEL "summary"="Humio Kubernetes Operator"
LABEL "description"="A Kubernetes operatator to run and maintain \
Humio clusters running in a Kubernetes cluster."
COPY LICENSE /licenses/LICENSE
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
USER 1001
ENTRYPOINT ["/manager"]