1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ ARG CUDA_COMPAT_VERSION=12-9
16+
1517FROM golang:1.25.3 AS builder
1618
1719ARG GOPROXY="https://proxy.golang.org,direct"
@@ -38,32 +40,29 @@ 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
42-
43- RUN dnf install -y --allowerasing \
44- curl \
45- && \
46- dnf clean all
47-
48- WORKDIR /workspace
43+ FROM registry.access.redhat.com/ubi9/ubi:latest AS sample-builder
4944
50- FROM nvcr.io/nvidia/cuda:12.9.1-base-ubi9 AS sample-builder
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
5147
48+ ARG CUDA_COMPAT_VERSION
5249RUN dnf install -y --allowerasing \
5350 cmake \
54- cuda-cudart-devel-12-9 \
55- cuda-nvcc-12-9 \
51+ cuda-cudart-devel-${CUDA_COMPAT_VERSION} \
52+ cuda-compat-${CUDA_COMPAT_VERSION} \
53+ cuda-nvcc-${CUDA_COMPAT_VERSION} \
5654 g++ \
5755 curl \
5856 && \
5957 dnf clean all
6058
59+ ENV PATH=/usr/local/cuda/bin:${PATH}
60+
6161WORKDIR /build
6262
6363ARG SAMPLE_NAME=vectorAdd
6464
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} | \
65+ RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/v${CUDA_COMPAT_VERSION/-/.} | \
6766 tar -xzvf - --strip-components=1 --wildcards */${SAMPLE_NAME}/* --wildcards */Common/* && \
6867 cd $(find /build/Samples -iname "${SAMPLE_NAME}" ) && \
6968 cmake . && \
@@ -93,10 +92,8 @@ COPY --from=builder /workspace/gpu-operator /usr/bin/
9392COPY --from=builder /workspace/manage-crds /usr/bin/
9493COPY --from=builder /workspace/nvidia-validator /usr/bin/
9594COPY --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
95+ ARG CUDA_COMPAT_VERSION
96+ COPY --from=sample-builder /usr/local/cuda-${CUDA_COMPAT_VERSION/-/.}/compat /usr/local/cuda/compat
10097
10198COPY assets /opt/gpu-operator/
10299COPY manifests /opt/gpu-operator/manifests
0 commit comments