1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- ARG CUDA_SAMPLE_IMAGE=undefined
1615ARG GOLANG_VERSION=x.x.x
1716
1817FROM nvcr.io/nvidia/cuda:12.9.0-base-ubi9 as builder
@@ -56,17 +55,17 @@ ARG VERSION="unknown"
5655ARG GIT_COMMIT="unknown"
5756RUN make cmds
5857
59- FROM ${CUDA_SAMPLE_IMAGE} AS sample-builder
60-
61- FROM nvcr.io/nvidia/cuda:12.9.0-base-ubi9
58+ # Install must-gather dependency: `kubectl`
59+ ARG TARGETARCH
60+ RUN OS_ARCH=${TARGETARCH/x86_64/amd64} && OS_ARCH=${OS_ARCH/aarch64/arm64} && curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${OS_ARCH}/kubectl
61+ RUN chmod +x ./kubectl
62+ RUN mv ./kubectl /usr/local/bin
6263
63- # Remove CUDA libs(compat etc) in favor of libs installed by the NVIDIA driver
64- RUN dnf remove -y cuda-*
64+ FROM nvcr.io/nvidia/k8s/cuda-sample:vectoradd-cuda12.5.0 AS sample-builder
6565
66- RUN dnf install -y \
67- kmod \
68- pciutils && \
69- rm -rf /var/cache/yum/*
66+ # The C/C++ distroless image is used as a base since the CUDA vectorAdd
67+ # sample application depends on C/C++ libraries.
68+ FROM nvcr.io/nvidia/distroless/cc:v3.1.7-dev
7069
7170ENV NVIDIA_VISIBLE_DEVICES=void
7271
@@ -84,40 +83,27 @@ LABEL vsc-ref=${GIT_COMMIT}
8483
8584WORKDIR /
8685COPY --from=builder /workspace/gpu-operator /usr/bin/
86+ COPY --from=builder /workspace/kubectl /usr/bin/
8787COPY --from=builder /workspace/nvidia-validator /usr/bin/
8888COPY --from=sample-builder /cuda-samples/vectorAdd /usr/bin/vectorAdd
89+ # TODO: Copy the compat libs from the 'sample-builder' image instead.
90+ # The current 'sample-builder' image does not contain the compat libs in the ARM variant.
91+ # Once new sample images are published that contain the compat libs, we can update the below.
92+ COPY --from=builder /usr/local/cuda/compat /usr/local/cuda/compat
8993
90- # gpu-operator manifests
91- RUN mkdir -p /opt/gpu-operator/manifests
9294COPY assets /opt/gpu-operator/
9395COPY manifests /opt/gpu-operator/manifests
96+ COPY validator/manifests /opt/validator/manifests
9497
95- # validator manifests
96- RUN mkdir -p /opt/validator/manifests
97- COPY validator/manifests/plugin-workload-validation.yaml /opt/validator/manifests
98- COPY validator/manifests/cuda-workload-validation.yaml /opt/validator/manifests
99-
100- RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
10198COPY hack/must-gather.sh /usr/bin/gather
10299
103- # Install must-gather dependency: `kubectl`
104- ARG TARGETARCH
105- RUN OS_ARCH=${TARGETARCH/x86_64/amd64} && OS_ARCH=${OS_ARCH/aarch64/arm64} && curl -LO https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${OS_ARCH}/kubectl
106- RUN chmod +x ./kubectl
107- RUN mv ./kubectl /usr/local/bin
108-
109100# Add CRD resource into the image for helm upgrades
110101COPY deployments/gpu-operator/crds/nvidia.com_clusterpolicies.yaml /opt/gpu-operator/nvidia.com_clusterpolicies.yaml
111102COPY deployments/gpu-operator/crds/nvidia.com_nvidiadrivers.yaml /opt/gpu-operator/nvidia.com_nvidiadrivers.yaml
112103COPY deployments/gpu-operator/charts/node-feature-discovery/crds/nfd-api-crds.yaml /opt/gpu-operator/nfd-api-crds.yaml
113104
114- # Install / upgrade packages here that are required to resolve CVEs
115- ARG CVE_UPDATES
116- RUN if [ -n "${CVE_UPDATES}" ]; then \
117- dnf update -y ${CVE_UPDATES} && \
118- rm -rf /var/cache/yum/*; \
119- fi
120-
121105USER 65532:65532
122106
107+ COPY LICENSE /licenses/
108+
123109ENTRYPOINT ["/usr/bin/gpu-operator" ]
0 commit comments