mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 13:35:00 +00:00
0b3bc13b32
This change adds platform-specific Dockerfiles and a Makefile
to build the toolkit-container images.
This image builds the container-config commands from the tools
directory and installs the components of the NVIDIA Container Toolkit
directly from the nvidia-container-toolkit and libnvidia-container*
packages in the dist directory.
This includes make targets for the centos7, centos8, ubuntu18.04,
and ubi8 container-toolkit images as well as the container tests
make targets implemented in the contianer-config repository.
Files adapted from:
383587f766
Signed-off-by: Evan Lezar <elezar@nvidia.com>
75 lines
2.5 KiB
Docker
75 lines
2.5 KiB
Docker
# 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 BASE_DIST
|
|
ARG CUDA_VERSION
|
|
ARG GOLANG_VERSION=x.x.x
|
|
ARG VERSION="N/A"
|
|
|
|
# NOTE: In cases where the libc version is a concern, we would have to use an
|
|
# image based on the target OS to build the golang executables here -- especially
|
|
# if cgo code is included.
|
|
FROM golang:${GOLANG_VERSION} as build
|
|
|
|
# We override the GOPATH to ensure that the binaries are installed to
|
|
# /artifacts/bin
|
|
ARG GOPATH=/artifacts
|
|
|
|
# Install the experiemental nvidia-container-runtime
|
|
# NOTE: This will be integrated into the nvidia-container-toolkit package / repo
|
|
ARG NVIDIA_CONTAINER_RUNTIME_EXPERIMENTAL_VERSION=experimental
|
|
RUN go install github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-container-runtime.experimental@${NVIDIA_CONTAINER_RUNTIME_EXPERIMENTAL_VERSION}
|
|
|
|
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`.
|
|
RUN go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...
|
|
|
|
|
|
FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}
|
|
|
|
ENV NVIDIA_DISABLE_REQUIRE="true"
|
|
ENV NVIDIA_VISIBLE_DEVICES=all
|
|
ENV NVIDIA_DRIVER_CAPABILITIES=utility
|
|
|
|
WORKDIR /artifacts/packages
|
|
|
|
ARG ARTIFACTS_DIR
|
|
COPY ${ARTIFACTS_DIR}/* /artifacts/packages
|
|
|
|
ARG PACKAGE_VERSION
|
|
RUN yum localinstall -y \
|
|
libnvidia-container1-${PACKAGE_VERSION}*.rpm \
|
|
libnvidia-container-tools-${PACKAGE_VERSION}*.rpm \
|
|
nvidia-container-toolkit-${PACKAGE_VERSION}*.rpm
|
|
|
|
WORKDIR /work
|
|
|
|
COPY --from=build /artifacts/bin /work
|
|
|
|
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"
|
|
|
|
COPY ./LICENSE /licenses/LICENSE
|
|
|
|
ENTRYPOINT ["/work/nvidia-toolkit"] |