forked from opendatahub-io/odh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.konflux
More file actions
95 lines (68 loc) · 2.94 KB
/
Dockerfile.konflux
File metadata and controls
95 lines (68 loc) · 2.94 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
83
84
85
86
87
88
89
90
91
92
93
94
95
# Build stage - use native platform for builder to avoid emulation
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.25@sha256:77bfb0f283eaa3215909342c3dda940605eff5b9f72d6dc18fad1d154d172d55 AS builder
# Build arguments for cross-compilation
ARG TARGETOS
ARG TARGETARCH
# Switch to root for installation
USER root
# Install make (using yum for go-toolset image)
RUN yum install -y make && yum clean all
WORKDIR /workspace
# Copy go mod files first for better layer caching
COPY go.mod go.sum ./
# Enable Go toolchain auto-download to match go.mod version requirement
ENV GOTOOLCHAIN=auto
RUN go mod download
# Copy source code and Makefile
COPY . .
# Build arguments for version information
ARG VERSION=dev
ARG COMMIT=unknown
ARG DATE=unknown
# Build using Makefile with cross-compilation
RUN make build \
GOOS=${TARGETOS} \
GOARCH=${TARGETARCH} \
VERSION=${VERSION} \
COMMIT=${COMMIT} \
DATE=${DATE}
FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi9/go-toolset:1.25@sha256:77bfb0f283eaa3215909342c3dda940605eff5b9f72d6dc18fad1d154d172d55 AS yq-builder
WORKDIR /workspace
USER root
COPY ./yq .
RUN CGO_ENABLED=1 GOEXPERIMENT=strictfipsruntime go build -tags strictfipsruntime -ldflags "-s -w" .
# Runtime stage
FROM registry.redhat.io/openshift4/ose-cli-rhel9:v4.21.0
# Build arguments for downloading architecture-specific binaries
ARG TARGETARCH
# Set default KUBECONFIG path for container usage
# Users can override this with -e KUBECONFIG=<path> when running the container
ENV KUBECONFIG=/kubeconfig
# Copy upgrade helpers from submodule folder
COPY ./rhoai-upgrade-helpers /opt/rhai-upgrade-helpers
# Copy requirements.txt
COPY ./requirements.txt ./requirements.txt
COPY --from=yq-builder /workspace/yq /usr/bin/yq
# Install base utilities (jq, wget, python3, python3-pip)
RUN yum install -y \
jq \
wget \
python3 \
python3-pip \
&& yum clean all
# Python deps for ray_cluster_migration.py (kubernetes, PyYAML)
RUN python3 -m pip install --use-pep517 -r requirements.txt
# Copy binary from builder (cross-compiled for target platform)
COPY --from=builder /workspace/bin/kubectl-odh /opt/rhai-cli/bin/rhai-cli
# Add rhai-cli to PATH
ENV PATH="/opt/rhai-cli/bin:${PATH}"
# Set entrypoint to rhai-cli binary
# Users can override with --entrypoint /bin/bash for interactive debugging
ENTRYPOINT ["/opt/rhai-cli/bin/rhai-cli"]
LABEL name="rhoai/odh-cli-rhel9" \
com.redhat.component="odh-cli-rhel9" \
io.k8s.display-name="odh-cli-rhel9" \
io.k8s.description="CLI tool for RHOAI (Red Hat OpenShift AI) for interacting with RHOAI deployments on Kubernetes." \
description="CLI tool for RHOAI (Red Hat OpenShift AI) for interacting with RHOAI deployments on Kubernetes." \
summary="CLI tool for RHOAI (Red Hat OpenShift AI) for interacting with RHOAI deployments on Kubernetes." \
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"