2021-10-11 14:33:02 +00:00
|
|
|
# Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
ARG GOLANG_VERSION=x.x.x
|
|
|
|
ARG VERSION="N/A"
|
|
|
|
|
2024-04-10 14:11:46 +00:00
|
|
|
FROM nvidia/cuda:12.4.1-base-ubuntu20.04 as build
|
2021-10-11 14:33:02 +00:00
|
|
|
|
2023-07-17 12:10:05 +00:00
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y wget make git gcc \
|
|
|
|
&& \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
ARG GOLANG_VERSION=x.x.x
|
|
|
|
RUN set -eux; \
|
|
|
|
\
|
|
|
|
arch="$(uname -m)"; \
|
|
|
|
case "${arch##*-}" in \
|
|
|
|
x86_64 | amd64) ARCH='amd64' ;; \
|
|
|
|
ppc64el | ppc64le) ARCH='ppc64le' ;; \
|
2024-02-28 19:43:48 +00:00
|
|
|
aarch64 | arm64) ARCH='arm64' ;; \
|
2023-07-17 12:10:05 +00:00
|
|
|
*) echo "unsupported architecture" ; exit 1 ;; \
|
|
|
|
esac; \
|
|
|
|
wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
|
|
|
|
| tar -C /usr/local -xz
|
|
|
|
|
|
|
|
ENV GOPATH /go
|
|
|
|
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
2021-10-11 14:33:02 +00:00
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
WORKDIR /build
|
2021-10-11 14:33:02 +00:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# NOTE: Until the config utilities are properly integrated into the
|
|
|
|
# nvidia-container-toolkit repository, these are built from the `tools` folder
|
|
|
|
# and not `cmd`.
|
2021-10-13 12:04:41 +00:00
|
|
|
RUN GOPATH=/artifacts go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...
|
2021-10-11 14:33:02 +00:00
|
|
|
|
|
|
|
|
2024-04-10 14:11:46 +00:00
|
|
|
FROM nvcr.io/nvidia/cuda:12.4.1-base-ubuntu20.04
|
2021-10-11 14:33:02 +00:00
|
|
|
|
2022-04-29 09:40:22 +00:00
|
|
|
# Remove the CUDA repository configurations to avoid issues with rotated GPG keys
|
|
|
|
RUN rm -f /etc/apt/sources.list.d/cuda.list
|
|
|
|
|
2021-10-11 14:33:02 +00:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
libcap2 \
|
2022-02-01 10:54:03 +00:00
|
|
|
curl \
|
2021-10-11 14:33:02 +00:00
|
|
|
&& \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
ENV NVIDIA_DISABLE_REQUIRE="true"
|
2023-08-15 09:51:54 +00:00
|
|
|
ENV NVIDIA_VISIBLE_DEVICES=void
|
2021-10-11 14:33:02 +00:00
|
|
|
ENV NVIDIA_DRIVER_CAPABILITIES=utility
|
|
|
|
|
2021-11-26 14:15:46 +00:00
|
|
|
ARG ARTIFACTS_ROOT
|
|
|
|
ARG PACKAGE_DIST
|
|
|
|
COPY ${ARTIFACTS_ROOT}/${PACKAGE_DIST} /artifacts/packages/${PACKAGE_DIST}
|
2021-11-23 19:59:52 +00:00
|
|
|
|
|
|
|
WORKDIR /artifacts/packages
|
2021-10-11 14:33:02 +00:00
|
|
|
|
|
|
|
ARG PACKAGE_VERSION
|
2022-02-01 10:54:03 +00:00
|
|
|
ARG TARGETARCH
|
|
|
|
ENV PACKAGE_ARCH ${TARGETARCH}
|
|
|
|
|
2021-10-11 14:33:02 +00:00
|
|
|
RUN dpkg -i \
|
2022-06-16 12:57:30 +00:00
|
|
|
${PACKAGE_DIST}/${PACKAGE_ARCH}/libnvidia-container1_1.*.deb \
|
|
|
|
${PACKAGE_DIST}/${PACKAGE_ARCH}/libnvidia-container-tools_1.*.deb \
|
2022-08-11 11:41:49 +00:00
|
|
|
${PACKAGE_DIST}/${PACKAGE_ARCH}/nvidia-container-toolkit*_${PACKAGE_VERSION}*.deb
|
2021-10-11 14:33:02 +00:00
|
|
|
|
|
|
|
WORKDIR /work
|
|
|
|
|
2021-10-13 12:04:41 +00:00
|
|
|
COPY --from=build /artifacts/bin /work/
|
2021-10-11 14:33:02 +00:00
|
|
|
|
|
|
|
ENV PATH=/work:$PATH
|
|
|
|
|
|
|
|
LABEL io.k8s.display-name="NVIDIA Container Runtime Config"
|
|
|
|
LABEL name="NVIDIA Container Runtime Config"
|
|
|
|
LABEL vendor="NVIDIA"
|
|
|
|
LABEL version="${VERSION}"
|
|
|
|
LABEL release="N/A"
|
|
|
|
LABEL summary="Automatically Configure your Container Runtime for GPU support."
|
|
|
|
LABEL description="See summary"
|
|
|
|
|
2022-06-08 19:04:21 +00:00
|
|
|
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
|
2021-10-11 14:33:02 +00:00
|
|
|
|
|
|
|
ENTRYPOINT ["/work/nvidia-toolkit"]
|