mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-25 13:35:00 +00:00
Specify CUDA base images directly in Dockerfile
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
cbc6ff73a4
commit
5682ce3149
@ -12,12 +12,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
ARG BASE_DIST
|
|
||||||
ARG CUDA_VERSION
|
|
||||||
ARG GOLANG_VERSION=x.x.x
|
ARG GOLANG_VERSION=x.x.x
|
||||||
ARG VERSION="N/A"
|
ARG VERSION="N/A"
|
||||||
|
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} as build
|
FROM nvidia/cuda:12.3.2-base-ubi8 as build
|
||||||
|
|
||||||
RUN yum install -y \
|
RUN yum install -y \
|
||||||
wget make git gcc \
|
wget make git gcc \
|
||||||
@ -50,17 +48,10 @@ COPY . .
|
|||||||
RUN GOPATH=/artifacts go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...
|
RUN GOPATH=/artifacts go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...
|
||||||
|
|
||||||
|
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}
|
FROM nvidia/cuda:12.3.2-base-ubi8
|
||||||
|
|
||||||
ARG BASE_DIST
|
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \
|
||||||
# See https://www.centos.org/centos-linux-eol/
|
|
||||||
# and https://stackoverflow.com/a/70930049 for move to vault.centos.org
|
|
||||||
# and https://serverfault.com/questions/1093922/failing-to-run-yum-update-in-centos-8 for move to vault.epel.cloud
|
|
||||||
RUN [[ "${BASE_DIST}" != "centos8" ]] || \
|
|
||||||
( \
|
|
||||||
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \
|
|
||||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-Linux-* \
|
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-Linux-* \
|
||||||
)
|
|
||||||
|
|
||||||
ENV NVIDIA_DISABLE_REQUIRE="true"
|
ENV NVIDIA_DISABLE_REQUIRE="true"
|
||||||
ENV NVIDIA_VISIBLE_DEVICES=void
|
ENV NVIDIA_VISIBLE_DEVICES=void
|
||||||
|
@ -12,11 +12,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
ARG BASE_DIST
|
|
||||||
ARG CUDA_VERSION
|
|
||||||
ARG GOLANG_VERSION=x.x.x
|
ARG GOLANG_VERSION=x.x.x
|
||||||
|
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}
|
FROM nvidia/cuda:12.3.2-base-ubuntu20.04
|
||||||
|
|
||||||
ARG ARTIFACTS_ROOT
|
ARG ARTIFACTS_ROOT
|
||||||
COPY ${ARTIFACTS_ROOT} /artifacts/packages/
|
COPY ${ARTIFACTS_ROOT} /artifacts/packages/
|
||||||
@ -24,7 +22,6 @@ COPY ${ARTIFACTS_ROOT} /artifacts/packages/
|
|||||||
WORKDIR /artifacts/packages
|
WORKDIR /artifacts/packages
|
||||||
|
|
||||||
# build-args are added to the manifest.txt file below.
|
# build-args are added to the manifest.txt file below.
|
||||||
ARG BASE_DIST
|
|
||||||
ARG PACKAGE_DIST
|
ARG PACKAGE_DIST
|
||||||
ARG PACKAGE_VERSION
|
ARG PACKAGE_VERSION
|
||||||
ARG GIT_BRANCH
|
ARG GIT_BRANCH
|
||||||
|
@ -12,12 +12,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
ARG BASE_DIST
|
|
||||||
ARG CUDA_VERSION
|
|
||||||
ARG GOLANG_VERSION=x.x.x
|
ARG GOLANG_VERSION=x.x.x
|
||||||
ARG VERSION="N/A"
|
ARG VERSION="N/A"
|
||||||
|
|
||||||
FROM nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST} as build
|
FROM nvidia/cuda:12.3.2-base-ubuntu20.04 as build
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y wget make git gcc \
|
apt-get install -y wget make git gcc \
|
||||||
@ -49,7 +47,7 @@ COPY . .
|
|||||||
RUN GOPATH=/artifacts go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...
|
RUN GOPATH=/artifacts go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...
|
||||||
|
|
||||||
|
|
||||||
FROM nvcr.io/nvidia/cuda:${CUDA_VERSION}-base-${BASE_DIST}
|
FROM nvcr.io/nvidia/cuda:12.3.2-base-ubuntu20.04
|
||||||
|
|
||||||
# Remove the CUDA repository configurations to avoid issues with rotated GPG keys
|
# Remove the CUDA repository configurations to avoid issues with rotated GPG keys
|
||||||
RUN rm -f /etc/apt/sources.list.d/cuda.list
|
RUN rm -f /etc/apt/sources.list.d/cuda.list
|
||||||
|
@ -96,8 +96,6 @@ $(BUILD_TARGETS): build-%: $(ARTIFACTS_ROOT)
|
|||||||
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
|
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
|
||||||
--tag $(IMAGE) \
|
--tag $(IMAGE) \
|
||||||
--build-arg ARTIFACTS_ROOT="$(ARTIFACTS_ROOT)" \
|
--build-arg ARTIFACTS_ROOT="$(ARTIFACTS_ROOT)" \
|
||||||
--build-arg BASE_DIST="$(BASE_DIST)" \
|
|
||||||
--build-arg CUDA_VERSION="$(CUDA_VERSION)" \
|
|
||||||
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
|
--build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \
|
||||||
--build-arg PACKAGE_DIST="$(PACKAGE_DIST)" \
|
--build-arg PACKAGE_DIST="$(PACKAGE_DIST)" \
|
||||||
--build-arg PACKAGE_VERSION="$(PACKAGE_VERSION)" \
|
--build-arg PACKAGE_VERSION="$(PACKAGE_VERSION)" \
|
||||||
@ -110,15 +108,12 @@ $(BUILD_TARGETS): build-%: $(ARTIFACTS_ROOT)
|
|||||||
$(CURDIR)
|
$(CURDIR)
|
||||||
|
|
||||||
|
|
||||||
build-ubuntu%: BASE_DIST = $(*)
|
|
||||||
build-ubuntu%: DOCKERFILE_SUFFIX := ubuntu
|
build-ubuntu%: DOCKERFILE_SUFFIX := ubuntu
|
||||||
build-ubuntu%: PACKAGE_DIST = ubuntu18.04
|
build-ubuntu%: PACKAGE_DIST = ubuntu18.04
|
||||||
|
|
||||||
build-ubi8: BASE_DIST := ubi8
|
|
||||||
build-ubi8: DOCKERFILE_SUFFIX := centos
|
build-ubi8: DOCKERFILE_SUFFIX := centos
|
||||||
build-ubi8: PACKAGE_DIST = centos7
|
build-ubi8: PACKAGE_DIST = centos7
|
||||||
|
|
||||||
build-packaging: BASE_DIST := ubuntu20.04
|
|
||||||
build-packaging: DOCKERFILE_SUFFIX := packaging
|
build-packaging: DOCKERFILE_SUFFIX := packaging
|
||||||
build-packaging: PACKAGE_ARCH := amd64
|
build-packaging: PACKAGE_ARCH := amd64
|
||||||
build-packaging: PACKAGE_DIST = all
|
build-packaging: PACKAGE_DIST = all
|
||||||
|
@ -27,7 +27,6 @@ PACKAGE_REVISION := 1
|
|||||||
NVIDIA_DOCKER_VERSION := 2.14.0
|
NVIDIA_DOCKER_VERSION := 2.14.0
|
||||||
NVIDIA_CONTAINER_RUNTIME_VERSION := 3.14.0
|
NVIDIA_CONTAINER_RUNTIME_VERSION := 3.14.0
|
||||||
|
|
||||||
CUDA_VERSION := 12.3.2
|
|
||||||
GOLANG_VERSION := 1.22.1
|
GOLANG_VERSION := 1.22.1
|
||||||
|
|
||||||
BUILDIMAGE_TAG ?= devel-go$(GOLANG_VERSION)
|
BUILDIMAGE_TAG ?= devel-go$(GOLANG_VERSION)
|
||||||
|
Loading…
Reference in New Issue
Block a user