forked from opendatahub-io/opendatahub-operator
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathDockerfile.konflux
More file actions
82 lines (66 loc) · 3.38 KB
/
Dockerfile.konflux
File metadata and controls
82 lines (66 loc) · 3.38 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Build the manager binary
################################################################################
FROM registry.redhat.io/ubi9/go-toolset:1.25@sha256:f9c8537423d96da6c0e704a7d40a1bd5401c4287a05c7f7f196550a5a375a6b6 as builder
# These built-in args are defined in the global scope, and are not automatically accessible within build stages or RUN commands.
# To expose these arguments inside the build stage, we need to redefine it without a value.
ARG TARGETOS TARGETARCH
RUN echo "GOOS=${TARGETOS} GOARCH=${TARGETARCH}"
USER root
WORKDIR /opt
# copy local manifests and charts to build
COPY opt/ /opt/
COPY prefetched-manifests/ /opt/manifests/
COPY prefetched-charts/ /opt/charts/
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY pkg/clusterhealth/go.mod pkg/clusterhealth/go.mod
COPY pkg/clusterhealth/go.sum pkg/clusterhealth/go.sum
COPY pkg/failureclassifier/go.mod pkg/failureclassifier/go.mod
COPY pkg/failureclassifier/go.sum pkg/failureclassifier/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 api/ api/
COPY internal/ internal/
COPY cmd/main.go cmd/main.go
COPY cmd/cloudmanager/ cmd/cloudmanager/
COPY pkg/ pkg/
# Copy ods-configs
COPY config/osd-configs/ /opt/manifests/osd-configs/
# Copy HWProfiles
COPY config/hardwareprofiles/ /opt/manifests/hardwareprofiles
# Copy connectionAPI removing any possibly pre-existing symlinks
COPY config/connectionAPI/ /opt/manifests/connectionAPI
# Clean up unwanted directories and files from manifests
RUN rm -rf /opt/manifests/*/e2e /opt/manifests/*/scorecard /opt/manifests/*/test /opt/manifests/*/samples /opt/manifests/*/example-* \
&& find /opt/manifests -name "README.md" -delete
# Build stripe out debug info to minimize binary size
RUN CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOEXPERIMENT=strictfipsruntime go build -a -ldflags="-s -w" -tags rhoai -o manager cmd/main.go
# Build cloudmanager binary
RUN CGO_ENABLED=${CGO_ENABLED} GOOS=linux GOARCH=${TARGETARCH} go build -a -ldflags="-s -w" -tags strictfipsruntime -o cloudmanager ./cmd/cloudmanager/
################################################################################
FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:fe9e574f04371b333ed4e21d30d984f6b7fcd1046e579f5ddab4816c0c8e231d
WORKDIR /
COPY --from=builder /workspace/manager .
COPY --from=builder /workspace/cloudmanager .
COPY --chown=1001:0 --from=builder /opt/manifests /opt/manifests-template
COPY --chown=1001:0 --from=builder /opt/charts /opt/charts
# tar installed to allow easy use of "oc cp" for component dev use cases.
# See hack/component-dev/README.md in the source repo for more info.
RUN microdnf install -y tar && microdnf clean all
# Recursive change all files
RUN chmod -R g=u /opt/manifests-template /opt/charts
USER 1001
ENTRYPOINT ["/manager"]
LABEL com.redhat.component="odh-operator-container" \
description="rhoai-operator" \
name="managed-open-data-hub/odh-rhel8-operator" \
summary="odh-operator" \
maintainer="['managed-open-data-hub@redhat.com']" \
io.openshift.expose-services="" \
io.k8s.display-name="odh-operator" \
io.k8s.description="odh-operator" \
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"