|
| 1 | +ARG BASE_IMAGE=ubuntu:resolute-20260707 |
| 2 | + |
| 3 | +FROM ${BASE_IMAGE} AS build |
| 4 | + |
| 5 | +ARG TARGETARCH |
| 6 | +ARG GOLANG_VERSION |
| 7 | + |
| 8 | +# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu |
| 9 | +ARG DRIVER_TYPE=passthrough |
| 10 | +ENV DRIVER_TYPE=$DRIVER_TYPE |
| 11 | + |
| 12 | +SHELL ["/bin/bash", "-c"] |
| 13 | + |
| 14 | +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
| 15 | + |
| 16 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 17 | + apt-utils \ |
| 18 | + build-essential \ |
| 19 | + ca-certificates \ |
| 20 | + curl \ |
| 21 | + git \ |
| 22 | + wget && \ |
| 23 | + rm -rf /var/lib/apt/lists/* |
| 24 | + |
| 25 | +# download appropriate binary based on the target architecture for multi-arch builds |
| 26 | +RUN OS_ARCH=${TARGETARCH/x86_64/amd64} && OS_ARCH=${OS_ARCH/aarch64/arm64} && \ |
| 27 | + wget -nv -O - https://go.dev/dl/go${GOLANG_VERSION}.linux-${OS_ARCH}.tar.gz \ |
| 28 | + | tar -C /usr/local -xz |
| 29 | + |
| 30 | +ENV PATH=/usr/local/go/bin:$PATH |
| 31 | + |
| 32 | +WORKDIR /work |
| 33 | + |
| 34 | +RUN if [ "$DRIVER_TYPE" = "vgpu" ]; then \ |
| 35 | + git clone https://github.com/NVIDIA/gpu-driver-container driver && \ |
| 36 | + cd driver/vgpu/src && \ |
| 37 | + go build -o vgpu-util && \ |
| 38 | + mv vgpu-util /work; fi |
| 39 | + |
| 40 | +FROM ${BASE_IMAGE} |
| 41 | + |
| 42 | +SHELL ["/bin/bash", "-c"] |
| 43 | + |
| 44 | +ARG TARGETARCH |
| 45 | +ENV TARGETARCH=$TARGETARCH |
| 46 | +ARG DRIVER_VERSION |
| 47 | +ARG GIT_COMMIT |
| 48 | +ENV DRIVER_VERSION=$DRIVER_VERSION |
| 49 | +ENV DEBIAN_FRONTEND=noninteractive |
| 50 | + |
| 51 | +# Arg to indicate if driver type is either of passthrough(baremetal) or vgpu |
| 52 | +ARG DRIVER_TYPE=passthrough |
| 53 | +ENV DRIVER_TYPE=$DRIVER_TYPE |
| 54 | +ARG DRIVER_BRANCH=595 |
| 55 | +ENV DRIVER_BRANCH=$DRIVER_BRANCH |
| 56 | +ARG VGPU_LICENSE_SERVER_TYPE=NLS |
| 57 | +ENV VGPU_LICENSE_SERVER_TYPE=$VGPU_LICENSE_SERVER_TYPE |
| 58 | +# Enable vGPU version compability check by default |
| 59 | +ARG DISABLE_VGPU_VERSION_CHECK=true |
| 60 | +ENV DISABLE_VGPU_VERSION_CHECK=$DISABLE_VGPU_VERSION_CHECK |
| 61 | +ENV NVIDIA_VISIBLE_DEVICES=void |
| 62 | + |
| 63 | +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections |
| 64 | + |
| 65 | +RUN echo "TARGETARCH=$TARGETARCH" |
| 66 | + |
| 67 | +ADD install.sh /tmp |
| 68 | + |
| 69 | +RUN usermod -o -u 0 -g 0 _apt && \ |
| 70 | + /tmp/install.sh depinstall |
| 71 | + |
| 72 | +# Install the driver payload for passthrough/baremetal types; the vgpu type installs from a |
| 73 | +# .run file at container start |
| 74 | +RUN /tmp/install.sh driver_pkgs_install |
| 75 | + |
| 76 | +COPY nvidia-driver /usr/local/bin |
| 77 | + |
| 78 | +COPY --from=build /work/vgpu-util* /usr/local/bin |
| 79 | + |
| 80 | +ADD drivers drivers/ |
| 81 | + |
| 82 | +WORKDIR /drivers |
| 83 | + |
| 84 | +# Install / upgrade packages here that are required to resolve CVEs |
| 85 | +ARG CVE_UPDATES |
| 86 | +RUN if [ -n "${CVE_UPDATES}" ]; then \ |
| 87 | + apt-get update && apt-get --only-upgrade -y install ${CVE_UPDATES} && \ |
| 88 | + rm -rf /var/lib/apt/lists/*; \ |
| 89 | + fi |
| 90 | + |
| 91 | +LABEL io.k8s.display-name="NVIDIA Driver Container" |
| 92 | +LABEL name="NVIDIA Driver Container" |
| 93 | +LABEL vendor="NVIDIA" |
| 94 | +LABEL version="${DRIVER_VERSION}" |
| 95 | +LABEL vcs-ref="${GIT_COMMIT}" |
| 96 | +LABEL release="N/A" |
| 97 | +LABEL summary="Provision the NVIDIA driver through containers" |
| 98 | +LABEL description="See summary" |
| 99 | + |
| 100 | +ENTRYPOINT ["nvidia-driver", "init"] |
0 commit comments