forked from openshift-psap/special-resource-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (36 loc) · 1.27 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
# Build the manager binary
FROM golang:1.18-bullseye AS builder
WORKDIR /workspace
# Following sections are ordered by expected chance of being changed in daily developer's work:
# go.mod is expected to change less frequently than the SRO's code.
# This approach leverages layer caching to speed up rebuilds.
COPY go.mod go.mod
COPY go.sum go.sum
RUN ["go", "mod", "download"]
COPY Makefile* ./
RUN ["make", "controller-gen"]
COPY cmd/ cmd/
RUN ["make", "helm-plugins/cm-getter/cm-getter"]
COPY hack/ hack/
COPY helm-plugins/ helm-plugins/
COPY scripts/ scripts/
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY internal/ internal/
COPY pkg/ pkg/
# Required to include the build information into the binary
COPY .git .git
RUN ["make", "manager"]
FROM debian:bullseye-slim
RUN ["apt", "update"]
RUN ["apt", "install", "-y", "ca-certificates"]
WORKDIR /
ENV HELM_PLUGINS /opt/helm-plugins
RUN useradd -r -u 499 nonroot
RUN getent group nonroot || groupadd -o -g 499 nonroot
COPY --from=builder /workspace/helm-plugins ${HELM_PLUGINS}
COPY --from=builder /workspace/manager /manager
ENTRYPOINT ["/manager"]
LABEL io.k8s.display-name="Special Resource Operator" \
io.k8s.description="SRO manages the lifecycle of out-of-tree drivers with enablement stack."