forked from opendatahub-io/odh-model-controller
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile.konflux
48 lines (37 loc) · 1.73 KB
/
Dockerfile.konflux
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
# Build arguments
ARG SOURCE_CODE=.
# Build the manager binary
FROM registry.redhat.io/ubi9/go-toolset:1.22.9@sha256:6402ad7886fb3bdaa950c89bdf338f8dbedde54c16bddb1157ebb8691b2def50 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}"
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/ internal/
# Build
USER root
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
FROM registry.redhat.io/ubi8/ubi-minimal@sha256:c38cc770631788157f8ea989df65ff30359c9f8af3246fef244b32caed9d5862 AS runtime
ARG USER=2000
LABEL com.redhat.component="odh-model-controller-container" \
name="managed-open-data-hub/odh-model-controller-rhel8" \
description="The controller removes the need for users to perform manual steps when deploying their models" \
summary="odh-model-controller" \
maintainer="['[email protected]']" \
io.openshift.expose-services="" \
io.k8s.display-name="odh-model-controller" \
io.k8s.description="odh-model-controller" \
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"
WORKDIR /
COPY --from=builder /workspace/manager .
USER ${USER}
ENTRYPOINT ["/manager"]