1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ ARG CUDA_SAMPLES_VERSION=12.9
16+
1517FROM golang:1.25.3 AS builder
1618
1719ARG GOPROXY="https://proxy.golang.org,direct"
@@ -38,32 +40,30 @@ ARG VERSION="unknown"
3840ARG GIT_COMMIT="unknown"
3941RUN make cmds
4042
41- FROM nvcr.io/nvidia/cuda:13.0.1-base- ubi9 AS cuda-base
43+ FROM registry.access.redhat.com/ ubi9/ubi:latest AS sample-builder
4244
43- RUN dnf install -y --allowerasing \
44- curl \
45- && \
46- dnf clean all
45+ RUN ARCH=$(uname -m) && OS_ARCH=${ARCH/amd64/x86_64} && OS_ARCH=${ARCH/aarch64/sbsa} && OS_ARCH=${ARCH/arm64/sbsa} \
46+ dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/$OS_ARCH/cuda-rhel9.repo
4747
48- WORKDIR /workspace
49-
50- FROM nvcr.io/nvidia/cuda:12.9.1-base-ubi9 AS sample-builder
51-
52- RUN dnf install -y --allowerasing \
48+ ARG CUDA_SAMPLES_VERSION
49+ RUN CUDA_PACKAGE_VERSION=${CUDA_SAMPLES_VERSION/./-} && \
50+ dnf install -y --allowerasing \
5351 cmake \
54- cuda-cudart-devel-12-9 \
55- cuda-nvcc-12-9 \
52+ cuda-cudart-devel-${CUDA_PACKAGE_VERSION} \
53+ cuda-compat-${CUDA_PACKAGE_VERSION} \
54+ cuda-nvcc-${CUDA_PACKAGE_VERSION} \
5655 g++ \
5756 curl \
5857 && \
5958 dnf clean all
6059
60+ ENV PATH=/usr/local/cuda/bin:${PATH}
61+
6162WORKDIR /build
6263
6364ARG SAMPLE_NAME=vectorAdd
6465
65- ARG CUDA_SAMPLES_VERSION=v12.9
66- RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/${CUDA_SAMPLES_VERSION} | \
66+ RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/v${CUDA_SAMPLES_VERSION} | \
6767 tar -xzvf - --strip-components=1 --wildcards */${SAMPLE_NAME}/* --wildcards */Common/* && \
6868 cd $(find /build/Samples -iname "${SAMPLE_NAME}" ) && \
6969 cmake . && \
@@ -93,10 +93,8 @@ COPY --from=builder /workspace/gpu-operator /usr/bin/
9393COPY --from=builder /workspace/manage-crds /usr/bin/
9494COPY --from=builder /workspace/nvidia-validator /usr/bin/
9595COPY --from=sample-builder /build/vectorAdd /usr/bin/vectorAdd
96- # TODO: Copy the compat libs from the 'sample-builder' image instead.
97- # The current 'sample-builder' image does not contain the compat libs in the ARM variant.
98- # Once new sample images are published that contain the compat libs, we can update the below.
99- COPY --from=cuda-base /usr/local/cuda/compat /usr/local/cuda/compat
96+ ARG CUDA_SAMPLES_VERSION
97+ COPY --from=sample-builder /usr/local/cuda-${CUDA_SAMPLES_VERSION}/compat /usr/local/cuda/compat
10098
10199COPY assets /opt/gpu-operator/
102100COPY manifests /opt/gpu-operator/manifests
0 commit comments