From 119a2df821f2ef6e6e54780003898fa77290405b Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 12 Jul 2024 17:11:29 +0200 Subject: [PATCH] Extract deb and rpm packages to single image This change swithces to using a single image for the NVIDIA Container Toolkit contianer. Here the contents of the architecture-specific deb and rpm packages are extracted to a known root. These contents can then be installed using the updated installation mechanism which has been updated to detect the source root based on the packaging type. Signed-off-by: Evan Lezar --- .github/workflows/image.yaml | 8 +- cmd/nvidia-ctk-installer/main.go | 65 +++++++- cmd/nvidia-ctk-installer/main_test.go | 2 +- .../toolkit/installer/installer.go | 7 +- cmd/nvidia-ctk-installer/toolkit/toolkit.go | 3 +- deployments/container/Dockerfile | 148 ++++++++++++++++++ deployments/container/Dockerfile.packaging | 38 ----- deployments/container/Dockerfile.ubi8 | 90 ----------- deployments/container/Dockerfile.ubuntu | 98 ------------ deployments/container/Makefile | 21 ++- tests/e2e/Makefile | 2 +- 11 files changed, 223 insertions(+), 259 deletions(-) create mode 100644 deployments/container/Dockerfile delete mode 100644 deployments/container/Dockerfile.packaging delete mode 100644 deployments/container/Dockerfile.ubi8 delete mode 100644 deployments/container/Dockerfile.ubuntu diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index b338b69c..37d88eeb 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -49,7 +49,7 @@ jobs: - ispr: true target: centos8-ppc64le fail-fast: false - + steps: - uses: actions/checkout@v4 name: Check out code @@ -80,14 +80,8 @@ jobs: strategy: matrix: dist: - - ubuntu20.04 - ubi8 - packaging - ispr: - - ${{ github.ref_name != 'main' && !startsWith( github.ref_name, 'release-' ) }} - exclude: - - ispr: true - dist: ubi8 needs: packages steps: - uses: actions/checkout@v4 diff --git a/cmd/nvidia-ctk-installer/main.go b/cmd/nvidia-ctk-installer/main.go index d6ae9aac..20a87366 100644 --- a/cmd/nvidia-ctk-installer/main.go +++ b/cmd/nvidia-ctk-installer/main.go @@ -14,6 +14,7 @@ import ( "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/toolkit" "github.com/NVIDIA/nvidia-container-toolkit/internal/info" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" + "github.com/NVIDIA/nvidia-container-toolkit/internal/lookup" ) const ( @@ -36,10 +37,11 @@ var signalReceived = make(chan bool, 1) type options struct { toolkitInstallDir string - noDaemon bool - runtime string - pidFile string - sourceRoot string + noDaemon bool + runtime string + pidFile string + sourceRoot string + packageType string toolkitOptions toolkit.Options runtimeOptions runtime.Options @@ -123,11 +125,17 @@ func (a app) build() *cli.App { EnvVars: []string{"TOOLKIT_INSTALL_DIR", "ROOT"}, }, &cli.StringFlag{ - Name: "source-root", - Value: "/", - Usage: "The folder where the required toolkit artifacts can be found", + Name: "toolkit-source-root", + Usage: "The folder where the required toolkit artifacts can be found. If this is not specified, the path /artifacts/{{ .ToolkitPackageType }} is used where ToolkitPackageType is the resolved package type", Destination: &options.sourceRoot, - EnvVars: []string{"SOURCE_ROOT"}, + EnvVars: []string{"TOOLKIT_SOURCE_ROOT"}, + }, + &cli.StringFlag{ + Name: "toolkit-package-type", + Usage: "specify the package type to use for the toolkit. One of ['deb', 'rpm', 'auto', '']. If 'auto' or '' are used, the type is inferred automatically.", + Value: "auto", + Destination: &options.packageType, + EnvVars: []string{"TOOLKIT_PACKAGE_TYPE"}, }, &cli.StringFlag{ Name: "pid-file", @@ -145,6 +153,15 @@ func (a app) build() *cli.App { } func (a *app) Before(c *cli.Context, o *options) error { + if o.sourceRoot == "" { + sourceRoot, err := a.resolveSourceRoot(o.runtimeOptions.HostRootMount, o.packageType) + if err != nil { + return fmt.Errorf("failed to resolve source root: %v", err) + } + a.logger.Infof("Resolved source root to %v", sourceRoot) + o.sourceRoot = sourceRoot + } + a.toolkit = toolkit.NewInstaller( toolkit.WithLogger(a.logger), toolkit.WithSourceRoot(o.sourceRoot), @@ -277,3 +294,35 @@ func (a *app) shutdown(pidFile string) { a.logger.Warningf("Unable to remove pidfile: %v", err) } } + +func (a *app) resolveSourceRoot(hostRoot string, packageType string) (string, error) { + resolvedPackageType, err := a.resolvePackageType(hostRoot, packageType) + if err != nil { + return "", err + } + switch resolvedPackageType { + case "deb": + return "/artifacts/deb", nil + case "rpm": + return "/artifacts/rpm", nil + default: + return "", fmt.Errorf("invalid package type: %v", resolvedPackageType) + } +} + +func (a *app) resolvePackageType(hostRoot string, packageType string) (rPackageTypes string, rerr error) { + if packageType != "" && packageType != "auto" { + return packageType, nil + } + + locator := lookup.NewExecutableLocator(a.logger, hostRoot) + if candidates, err := locator.Locate("/usr/bin/rpm"); err == nil && len(candidates) > 0 { + return "rpm", nil + } + + if candidates, err := locator.Locate("/usr/bin/dpkg"); err == nil && len(candidates) > 0 { + return "deb", nil + } + + return "deb", nil +} diff --git a/cmd/nvidia-ctk-installer/main_test.go b/cmd/nvidia-ctk-installer/main_test.go index b98bf3ea..ce2c25ea 100644 --- a/cmd/nvidia-ctk-installer/main_test.go +++ b/cmd/nvidia-ctk-installer/main_test.go @@ -418,7 +418,7 @@ swarm-resource = "" "--driver-root-ctr-path=" + hostRoot, "--pid-file=" + filepath.Join(testRoot, "toolkit.pid"), "--restart-mode=none", - "--source-root=" + filepath.Join(artifactRoot, "deb"), + "--toolkit-source-root=" + filepath.Join(artifactRoot, "deb"), } err := app.Run(append(testArgs, tc.args...)) diff --git a/cmd/nvidia-ctk-installer/toolkit/installer/installer.go b/cmd/nvidia-ctk-installer/toolkit/installer/installer.go index 86c734a5..80bccbf3 100644 --- a/cmd/nvidia-ctk-installer/toolkit/installer/installer.go +++ b/cmd/nvidia-ctk-installer/toolkit/installer/installer.go @@ -47,7 +47,9 @@ var _ Installer = (*toolkitInstaller)(nil) // New creates a toolkit installer with the specified options. func New(opts ...Option) (Installer, error) { - t := &toolkitInstaller{} + t := &toolkitInstaller{ + sourceRoot: "/", + } for _, opt := range opts { opt(t) } @@ -55,9 +57,6 @@ func New(opts ...Option) (Installer, error) { if t.logger == nil { t.logger = logger.New() } - if t.sourceRoot == "" { - t.sourceRoot = "/" - } if t.artifactRoot == nil { artifactRoot, err := newArtifactRoot(t.logger, t.sourceRoot) if err != nil { diff --git a/cmd/nvidia-ctk-installer/toolkit/toolkit.go b/cmd/nvidia-ctk-installer/toolkit/toolkit.go index 037b2a94..f2471332 100644 --- a/cmd/nvidia-ctk-installer/toolkit/toolkit.go +++ b/cmd/nvidia-ctk-installer/toolkit/toolkit.go @@ -215,7 +215,8 @@ func Flags(opts *Options) []cli.Flag { // An Installer is used to install the NVIDIA Container Toolkit from the toolkit container. type Installer struct { - logger logger.Interface + logger logger.Interface + sourceRoot string // toolkitRoot specifies the destination path at which the toolkit is installed. toolkitRoot string diff --git a/deployments/container/Dockerfile b/deployments/container/Dockerfile new file mode 100644 index 00000000..74fae81a --- /dev/null +++ b/deployments/container/Dockerfile @@ -0,0 +1,148 @@ +# 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" + +FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 AS build + +RUN yum install -y \ + wget make git gcc \ + && \ + rm -rf /var/cache/yum/* + +ARG GOLANG_VERSION=x.x.x +RUN set -eux; \ + \ + arch="$(uname -m)"; \ + case "${arch##*-}" in \ + x86_64 | amd64) ARCH='amd64' ;; \ + ppc64el | ppc64le) ARCH='ppc64le' ;; \ + aarch64 | arm64) ARCH='arm64' ;; \ + *) 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 + +WORKDIR /build +COPY . . + +RUN mkdir /artifacts +ARG VERSION="N/A" +ARG GIT_COMMIT="unknown" +RUN make PREFIX=/artifacts cmd-nvidia-ctk-installer + +# The packaging stage collects the deb and rpm packages built for supported +# architectures. +FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 AS packaging + +ARG ARTIFACTS_ROOT +COPY ${ARTIFACTS_ROOT} /artifacts/packages/ + +WORKDIR /artifacts/packages + +# build-args are added to the manifest.txt file below. +ARG PACKAGE_VERSION +ARG GIT_BRANCH +ARG GIT_COMMIT +ARG GIT_COMMIT_SHORT +ARG SOURCE_DATE_EPOCH +ARG VERSION + +# Create a manifest.txt file with the absolute paths of all deb and rpm packages in the container +RUN echo "#IMAGE_EPOCH=$(date '+%s')" > /artifacts/manifest.txt && \ + env | sed 's/^/#/g' >> /artifacts/manifest.txt && \ + find /artifacts/packages -iname '*.deb' -o -iname '*.rpm' >> /artifacts/manifest.txt + +RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE + +# The debpackages stage is used to extract the contents of deb packages. +FROM nvcr.io/nvidia/cuda:12.8.1-base-ubuntu20.04 AS debpackages + +ARG TARGETARCH +ARG PACKAGE_DIST_DEB=ubuntu18.04 + +COPY --from=packaging /artifacts/packages/${PACKAGE_DIST_DEB} /deb-packages + +RUN mkdir -p /artifacts/deb +RUN set -eux; \ + \ + case "${TARGETARCH}" in \ + x86_64 | amd64) ARCH='amd64' ;; \ + ppc64el | ppc64le) ARCH='ppc64le' ;; \ + aarch64 | arm64) ARCH='arm64' ;; \ + *) echo "unsupported architecture" ; exit 1 ;; \ + esac; \ + for p in $(ls /deb-packages/${ARCH}/*.deb); do dpkg-deb -xv $p /artifacts/deb/; done + +# The rpmpackages stage is used to extract the contents of the rpm packages. +FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 AS rpmpackages +RUN dnf install -y cpio + +ARG TARGETARCH +ARG PACKAGE_DIST_RPM=centos7 + +COPY --from=packaging /artifacts/packages/${PACKAGE_DIST_RPM} /rpm-packages + +RUN mkdir -p /artifacts/rpm +RUN set -eux; \ + \ + case "${TARGETARCH}" in \ + x86_64 | amd64) ARCH='x86_64' ;; \ + ppc64el | ppc64le) ARCH='ppc64le' ;; \ + aarch64 | arm64) ARCH='aarch64' ;; \ + *) echo "unsupported architecture" ; exit 1 ;; \ + esac; \ + for p in $(ls /rpm-packages/${ARCH}/*.rpm); do rpm2cpio $p | cpio -idmv -D /artifacts/rpm; done + +# The artifacts image serves as an intermediate stage to collect the artifacts +# From the previous stages: +# - The extracted deb packages +# - The extracted rpm packages +# - The nvidia-ctk-installer binary +FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 AS artifacts + +COPY --from=rpmpackages /artifacts/rpm /artifacts/rpm +COPY --from=debpackages /artifacts/deb /artifacts/deb +COPY --from=build /artifacts/bin /artifacts/build + +FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 + +ENV NVIDIA_DISABLE_REQUIRE="true" +ENV NVIDIA_VISIBLE_DEVICES=void +ENV NVIDIA_DRIVER_CAPABILITIES=utility + +COPY --from=artifacts /artifacts/rpm /artifacts/rpm +COPY --from=artifacts /artifacts/deb /artifacts/deb +COPY --from=artifacts /artifacts/build /work + +WORKDIR /work +ENV PATH=/work:$PATH + +ARG VERSION +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" + +RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE + +ENTRYPOINT ["/work/nvidia-ctk-installer"] diff --git a/deployments/container/Dockerfile.packaging b/deployments/container/Dockerfile.packaging deleted file mode 100644 index 9fb5fb84..00000000 --- a/deployments/container/Dockerfile.packaging +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 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 - -FROM nvcr.io/nvidia/cuda:12.8.1-base-ubuntu20.04 - -ARG ARTIFACTS_ROOT -COPY ${ARTIFACTS_ROOT} /artifacts/packages/ - -WORKDIR /artifacts/packages - -# build-args are added to the manifest.txt file below. -ARG PACKAGE_DIST -ARG PACKAGE_VERSION -ARG GIT_BRANCH -ARG GIT_COMMIT -ARG GIT_COMMIT_SHORT -ARG SOURCE_DATE_EPOCH -ARG VERSION - -# Create a manifest.txt file with the absolute paths of all deb and rpm packages in the container -RUN echo "#IMAGE_EPOCH=$(date '+%s')" > /artifacts/manifest.txt && \ - env | sed 's/^/#/g' >> /artifacts/manifest.txt && \ - find /artifacts/packages -iname '*.deb' -o -iname '*.rpm' >> /artifacts/manifest.txt - -RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE diff --git a/deployments/container/Dockerfile.ubi8 b/deployments/container/Dockerfile.ubi8 deleted file mode 100644 index 4efa622b..00000000 --- a/deployments/container/Dockerfile.ubi8 +++ /dev/null @@ -1,90 +0,0 @@ -# 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" - -FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 AS build - -RUN yum install -y \ - wget make git gcc \ - && \ - rm -rf /var/cache/yum/* - -ARG GOLANG_VERSION=x.x.x -RUN set -eux; \ - \ - arch="$(uname -m)"; \ - case "${arch##*-}" in \ - x86_64 | amd64) ARCH='amd64' ;; \ - ppc64el | ppc64le) ARCH='ppc64le' ;; \ - aarch64 | arm64) ARCH='arm64' ;; \ - *) 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 - -WORKDIR /build -COPY . . - -RUN mkdir /artifacts -ARG VERSION="N/A" -ARG GIT_COMMIT="unknown" -RUN make PREFIX=/artifacts cmd-nvidia-ctk-installer - -FROM nvcr.io/nvidia/cuda:12.8.1-base-ubi8 - -ENV NVIDIA_DISABLE_REQUIRE="true" -ENV NVIDIA_VISIBLE_DEVICES=void -ENV NVIDIA_DRIVER_CAPABILITIES=utility - -ARG ARTIFACTS_ROOT -ARG PACKAGE_DIST -COPY ${ARTIFACTS_ROOT}/${PACKAGE_DIST} /artifacts/packages/${PACKAGE_DIST} - -WORKDIR /artifacts/packages - -ARG PACKAGE_VERSION -ARG TARGETARCH -ENV PACKAGE_ARCH=${TARGETARCH} - -RUN PACKAGE_ARCH=${PACKAGE_ARCH/amd64/x86_64} && PACKAGE_ARCH=${PACKAGE_ARCH/arm64/aarch64} && \ - yum localinstall -y \ - ${PACKAGE_DIST}/${PACKAGE_ARCH}/libnvidia-container1-1.*.rpm \ - ${PACKAGE_DIST}/${PACKAGE_ARCH}/libnvidia-container-tools-1.*.rpm \ - ${PACKAGE_DIST}/${PACKAGE_ARCH}/nvidia-container-toolkit*-${PACKAGE_VERSION}*.rpm - -WORKDIR /work - -COPY --from=build /artifacts/nvidia-ctk-installer /work/nvidia-ctk-installer -RUN ln -s nvidia-ctk-installer nvidia-toolkit - -ENV PATH=/work:$PATH - -ARG VERSION -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" - -RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE - -ENTRYPOINT ["/work/nvidia-ctk-installer"] diff --git a/deployments/container/Dockerfile.ubuntu b/deployments/container/Dockerfile.ubuntu deleted file mode 100644 index c5e8d156..00000000 --- a/deployments/container/Dockerfile.ubuntu +++ /dev/null @@ -1,98 +0,0 @@ -# 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" - -FROM nvcr.io/nvidia/cuda:12.8.1-base-ubuntu20.04 AS build - -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' ;; \ - aarch64 | arm64) ARCH='arm64' ;; \ - *) 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 - -WORKDIR /build -COPY . . - -RUN mkdir /artifacts -ARG VERSION="N/A" -ARG GIT_COMMIT="unknown" -RUN make PREFIX=/artifacts cmd-nvidia-ctk-installer - -FROM nvcr.io/nvidia/cuda:12.8.1-base-ubuntu20.04 - -# Remove the CUDA repository configurations to avoid issues with rotated GPG keys -RUN rm -f /etc/apt/sources.list.d/cuda.list - -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y --no-install-recommends \ - libcap2 \ - curl \ - && \ - rm -rf /var/lib/apt/lists/* - -ENV NVIDIA_DISABLE_REQUIRE="true" -ENV NVIDIA_VISIBLE_DEVICES=void -ENV NVIDIA_DRIVER_CAPABILITIES=utility - -ARG ARTIFACTS_ROOT -ARG PACKAGE_DIST -COPY ${ARTIFACTS_ROOT}/${PACKAGE_DIST} /artifacts/packages/${PACKAGE_DIST} - -WORKDIR /artifacts/packages - -ARG PACKAGE_VERSION -ARG TARGETARCH -ENV PACKAGE_ARCH=${TARGETARCH} - -RUN dpkg -i \ - ${PACKAGE_DIST}/${PACKAGE_ARCH}/libnvidia-container1_1.*.deb \ - ${PACKAGE_DIST}/${PACKAGE_ARCH}/libnvidia-container-tools_1.*.deb \ - ${PACKAGE_DIST}/${PACKAGE_ARCH}/nvidia-container-toolkit*_${PACKAGE_VERSION}*.deb - -WORKDIR /work - -COPY --from=build /artifacts/nvidia-ctk-installer /work/nvidia-ctk-installer -RUN ln -s nvidia-ctk-installer nvidia-toolkit - -ENV PATH=/work:$PATH - -ARG VERSION -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" - -RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE - -ENTRYPOINT ["/work/nvidia-ctk-installer"] diff --git a/deployments/container/Makefile b/deployments/container/Makefile index a2a1f23b..caf57ad1 100644 --- a/deployments/container/Makefile +++ b/deployments/container/Makefile @@ -38,8 +38,8 @@ OUT_IMAGE_TAG = $(OUT_IMAGE_VERSION)-$(DIST) OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_TAG) ##### Public rules ##### -DEFAULT_PUSH_TARGET := ubuntu20.04 -DISTRIBUTIONS := ubuntu20.04 ubi8 +DEFAULT_PUSH_TARGET := ubi8 +DISTRIBUTIONS := $(DEFAULT_PUSH_TARGET) META_TARGETS := packaging @@ -79,7 +79,7 @@ push-short: build-%: DIST = $(*) -build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile.$(DOCKERFILE_SUFFIX) +build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile ARTIFACTS_ROOT ?= $(shell realpath --relative-to=$(CURDIR) $(DIST_DIR)) @@ -90,10 +90,12 @@ $(IMAGE_TARGETS): image-%: $(ARTIFACTS_ROOT) --provenance=false --sbom=false \ $(DOCKER_BUILD_OPTIONS) \ $(DOCKER_BUILD_PLATFORM_OPTIONS) \ + $(INTERMEDIATE_TARGET) \ --tag $(IMAGE) \ --build-arg ARTIFACTS_ROOT="$(ARTIFACTS_ROOT)" \ --build-arg GOLANG_VERSION="$(GOLANG_VERSION)" \ - --build-arg PACKAGE_DIST="$(PACKAGE_DIST)" \ + --build-arg PACKAGE_DIST_DEB="$(PACKAGE_DIST_DEB)" \ + --build-arg PACKAGE_DIST_RPM="$(PACKAGE_DIST_RPM)" \ --build-arg PACKAGE_VERSION="$(PACKAGE_VERSION)" \ --build-arg VERSION="$(VERSION)" \ --build-arg GIT_COMMIT="$(GIT_COMMIT)" \ @@ -103,15 +105,12 @@ $(IMAGE_TARGETS): image-%: $(ARTIFACTS_ROOT) -f $(DOCKERFILE) \ $(CURDIR) -build-ubuntu%: DOCKERFILE_SUFFIX := ubuntu -build-ubuntu%: PACKAGE_DIST = ubuntu18.04 -build-ubi8: DOCKERFILE_SUFFIX := ubi8 -build-ubi8: PACKAGE_DIST = centos7 +PACKAGE_DIST_DEB = ubuntu18.04 +# TODO: This needs to be set to centos8 for ppc64le builds +PACKAGE_DIST_RPM = centos7 -build-packaging: DOCKERFILE_SUFFIX := packaging -build-packaging: PACKAGE_ARCH := amd64 -build-packaging: PACKAGE_DIST = all +build-packaging: INTERMEDIATE_TARGET := --target=packaging # Test targets test-%: DIST = $(*) diff --git a/tests/e2e/Makefile b/tests/e2e/Makefile index cc11366e..4241d601 100644 --- a/tests/e2e/Makefile +++ b/tests/e2e/Makefile @@ -21,7 +21,7 @@ E2E_RUNTIME ?= docker E2E_INSTALL_CTK ?= false ifeq ($($(DIST)),) -DIST ?= ubuntu20.04 +DIST ?= ubi8 endif IMAGE_TAG ?= $(VERSION)-$(DIST) IMAGE = $(IMAGE_NAME):$(IMAGE_TAG)