Skip to content

Commit b24fcc2

Browse files
authored
Merge pull request #14 from NVIDIA/upd-base-images
Fix issues in building sample images.
2 parents 2502eaa + a30a9eb commit b24fcc2

File tree

9 files changed

+112
-63
lines changed

9 files changed

+112
-63
lines changed

.common-ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ stages:
4343
variables:
4444
DIST: ubuntu22.04
4545

46-
.dist-ubi8:
46+
.dist-ubi9:
4747
variables:
48-
DIST: ubi8
48+
DIST: ubi9
4949

5050
# Define the platform targets
5151
.platform-amd64:
@@ -154,13 +154,13 @@ stages:
154154
OUT_IMAGE_VERSION: "${DEVEL_RELEASE_IMAGE_VERSION}"
155155

156156
# Define the release jobs
157-
release:staging-vectoradd-ubi8:
157+
release:staging-vectoradd-ubi9:
158158
extends:
159159
- .release:staging
160-
- .dist-ubi8
160+
- .dist-ubi9
161161
- .sample-vectoradd
162162
needs:
163-
- image-vectoradd-ubi8
163+
- image-vectoradd-ubi9
164164

165165
release:staging-vectoradd-ubuntu22.04:
166166
extends:

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ jobs:
3232
secrets: inherit
3333
with:
3434
version: ${{ needs.basic.outputs.version }}
35-
build_multi_arch_images: ${{ github.ref_name == 'main' || startsWith(github.ref_name, 'release-') }}

.github/workflows/image.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ on:
2222
required: true
2323
type: string
2424
build_multi_arch_images:
25-
required: true
25+
required: false
2626
type: string
27+
default: true
2728

2829
jobs:
2930
build:
@@ -32,15 +33,15 @@ jobs:
3233
matrix:
3334
dist:
3435
- ubuntu22.04
35-
- ubi8
36+
- ubi9
3637
sample:
3738
- vectorAdd
3839
- nbody
3940
- deviceQuery
4041
exclude:
41-
- dist: ubi8
42+
- dist: ubi9
4243
sample: deviceQuery
43-
- dist: ubi8
44+
- dist: ubi9
4445
sample: nbody
4546
steps:
4647
- uses: actions/checkout@v4
@@ -49,7 +50,7 @@ jobs:
4950
- name: Set up QEMU
5051
uses: docker/setup-qemu-action@v3
5152
with:
52-
image: tonistiigi/binfmt:master
53+
image: tonistiigi/binfmt:qemu-v7.0.0-28
5354

5455
- name: Set up Docker Buildx
5556
uses: docker/setup-buildx-action@v3

.nvidia-ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ image-vectoradd-ubuntu22.04:
7272
- .dist-ubuntu22.04
7373
- .sample-vectoradd
7474

75-
image-vectoradd-ubi8:
75+
image-vectoradd-ubi9:
7676
extends:
7777
- .image-pull
78-
- .dist-ubi8
78+
- .dist-ubi9
7979
- .sample-vectoradd
8080

8181
image-device-query-ubuntu22.04:
@@ -160,24 +160,24 @@ scan-device-query-ubuntu22.04-arm64:
160160
- image-device-query-ubuntu22.04
161161
- scan-device-query-ubuntu22.04-amd64
162162

163-
scan-vectoradd-ubi8-amd64:
163+
scan-vectoradd-ubi9-amd64:
164164
extends:
165165
- .scan
166166
- .sample-vectoradd
167-
- .dist-ubi8
167+
- .dist-ubi9
168168
- .platform-amd64
169169
needs:
170-
- image-vectoradd-ubi8
170+
- image-vectoradd-ubi9
171171

172-
scan-vectoradd-ubi8-arm64:
172+
scan-vectoradd-ubi9-arm64:
173173
extends:
174174
- .scan
175175
- .sample-vectoradd
176-
- .dist-ubi8
176+
- .dist-ubi9
177177
- .platform-arm64
178178
needs:
179-
- image-vectoradd-ubi8
180-
- scan-vectoradd-ubi8-amd64
179+
- image-vectoradd-ubi9
180+
- scan-vectoradd-ubi9-amd64
181181

182182
scan-nbody-ubuntu22.04-amd64:
183183
extends:
@@ -222,10 +222,10 @@ release:ngc-device-query-ubuntu22.04:
222222
- .dist-ubuntu22.04
223223
- .sample-device-query
224224

225-
release:ngc-vectoradd-ubi8:
225+
release:ngc-vectoradd-ubi9:
226226
extends:
227227
- .release:ngc
228-
- .dist-ubi8
228+
- .dist-ubi9
229229
- .sample-vectoradd
230230

231231
release:ngc-nbody-ubuntu22.04:

deployments/container/Dockerfile.ubi8 renamed to deployments/container/Dockerfile.ubi9

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM nvidia/cuda:12.6.2-devel-ubi8 AS builder
15+
FROM nvcr.io/nvidia/cuda:12.6.2-devel-ubi9 AS builder
1616

1717
ARG CUDA_VERSION
18-
RUN dnf install -y \
18+
RUN dnf install -y --allowerasing \
1919
curl \
2020
&& \
2121
dnf clean all
@@ -24,14 +24,14 @@ WORKDIR /build
2424

2525
ARG SAMPLE_NAME
2626
ENV SAMPLE_NAME ${SAMPLE_NAME}
27-
ARG CUDA_SAMPLES_VERSION=v11.6
27+
ARG CUDA_SAMPLES_VERSION=v12.0
2828
RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/${CUDA_SAMPLES_VERSION} | \
2929
tar -xzvf - --strip-components=1 --wildcards */${SAMPLE_NAME}/* --wildcards */Common/* && \
3030
cd $(find /build/Samples -iname "${SAMPLE_NAME}") && \
3131
make build && \
3232
cp $(find /build/bin -iname "${SAMPLE_NAME}") /build/${SAMPLE_NAME}
3333

34-
FROM nvidia/cuda:12.6.2-base-ubi8
34+
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubi9
3535
ARG SAMPLE_NAME
3636
LABEL io.k8s.display-name="NVIDIA CUDA ${SAMPLE_NAME} sample"
3737
LABEL name="NVIDIA CUDA ${SAMPLE_NAME} sample"
@@ -43,13 +43,6 @@ LABEL description="See summary"
4343

4444
COPY ./LICENSE ./licenses/LICENSE
4545

46-
# Install / upgrade packages here that are required to resolve CVEs
47-
ARG CVE_UPDATES
48-
RUN if [ -n "${CVE_UPDATES}" ]; then \
49-
yum update -y ${CVE_UPDATES} && \
50-
rm -rf /var/cache/yum/*; \
51-
fi
52-
5346
RUN mkdir -p /cuda-samples
5447
COPY --from=builder /build/${SAMPLE_NAME} /cuda-samples/${SAMPLE_NAME}
5548

deployments/container/Dockerfile.ubuntu

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,30 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM nvidia/cuda:12.6.2-devel-ubuntu22.04 AS builder
15+
FROM nvcr.io/nvidia/cuda:12.6.2-devel-ubuntu22.04 AS builder
1616

1717
ARG SAMPLE_NAME
1818
ENV SAMPLE_NAME ${SAMPLE_NAME}
1919

2020
ARG DEBIAN_FRONTEND=noninteractive
2121
RUN apt-get update && apt-get install -y --no-install-recommends \
2222
curl \
23-
&& ( \
24-
# The nbody sample requires libGL, libGLU, and libglut
25-
test "${SAMPLE_NAME}" != "nbody" || apt-get install -y --no-install-recommends \
26-
freeglut3-dev \
27-
libgl1-mesa-dev \
28-
libglu1-mesa-dev \
29-
) \
3023
&& \
3124
rm -rf /var/lib/apt/lists/*
3225

3326
WORKDIR /build
3427

3528
ARG TARGETARCH
3629

37-
ARG CUDA_SAMPLES_VERSION=v11.6
30+
ARG CUDA_SAMPLES_VERSION=v12.0
3831
RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/${CUDA_SAMPLES_VERSION} | \
3932
tar -xzvf - --strip-components=1 --wildcards */${SAMPLE_NAME}/* --wildcards */Common/* && \
4033
cd $(find /build/Samples -iname "${SAMPLE_NAME}") && \
4134
make build && \
4235
cp $(find /build/bin -iname "${SAMPLE_NAME}") /build/${SAMPLE_NAME}
4336

44-
FROM nvidia/cuda:12.6.2-base-ubuntu22.04
45-
ARG SAMPLE_NAME
37+
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubuntu22.04
38+
ARG SAMPLE_NAME=nbody
4639
LABEL io.k8s.display-name="NVIDIA CUDA ${SAMPLE_NAME} sample"
4740
LABEL name="NVIDIA CUDA ${SAMPLE_NAME} sample"
4841
LABEL vendor="NVIDIA"
@@ -51,23 +44,8 @@ LABEL release="N/A"
5144
LABEL summary="NVIDIA container to validate GPU support"
5245
LABEL description="See summary"
5346

54-
# The nbody sample requires libGL, libGLU, and libglut
55-
RUN test "${SAMPLE_NAME}" = "nbody" && apt-get update && apt-get install -y --no-install-recommends \
56-
freeglut3 \
57-
libgl1 \
58-
libglu1 \
59-
&& \
60-
rm -rf /var/lib/apt/lists/* || :
61-
6247
COPY ./LICENSE ./licenses/LICENSE
6348

64-
# Install / upgrade packages here that are required to resolve CVEs
65-
ARG CVE_UPDATES
66-
RUN if [ -n "${CVE_UPDATES}" ]; then \
67-
apt-get update && apt-get upgrade -y ${CVE_UPDATES} && \
68-
rm -rf /var/lib/apt/lists/*; \
69-
fi
70-
7149
RUN mkdir -p /cuda-samples
7250
COPY --from=builder /build/${SAMPLE_NAME} /cuda-samples/${SAMPLE_NAME}
7351

deployments/container/Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,20 @@ OUT_IMAGE_TAG ?= $(LOWER_CASE_SAMPLE)-$(OUT_IMAGE_VERSION)-$(DIST)
4545
OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_TAG)
4646

4747
DEFAULT_PUSH_TARGET := ubuntu22.04
48-
DISTRIBUTIONS := ubuntu22.04 ubi8
48+
DISTRIBUTIONS := ubuntu22.04 ubi9
4949

5050
BUILD_TARGETS := $(patsubst %,build-%, $(DISTRIBUTIONS))
5151
PUSH_TARGETS := $(patsubst %,push-%, $(DISTRIBUTIONS))
5252
TEST_TARGETS := $(patsubst %,test-%, $(DISTRIBUTIONS))
5353

5454
.PHONY: $(DISTRIBUTIONS) $(PUSH_TARGETS) $(BUILD_TARGETS) $(TEST_TARGETS)
5555

56+
# Certain samples do not allow multi-arch images. We disable them here.
57+
# TODO: Does it make more sense to set this at a CI-level?
58+
ifeq ($(SAMPLE),nbody)
59+
BUILD_MULTI_ARCH_IMAGES = false
60+
endif
61+
5662
ifneq ($(BUILD_MULTI_ARCH_IMAGES),true)
5763
include $(CURDIR)/deployments/container/native-only.mk
5864
else
@@ -80,11 +86,15 @@ endif
8086
endif
8187

8288
build-%: DIST = $(*)
89+
ifeq ($(SAMPLE),nbody)
90+
build-%: DOCKERFILE = $(CURDIR)/deployments/container/$(SAMPLE)/Dockerfile
91+
else
8392
build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile.$(DOCKERFILE_SUFFIX)
93+
endif
8494

8595
build-ubuntu%: DOCKERFILE_SUFFIX = ubuntu
8696

87-
build-ubi8: DOCKERFILE_SUFFIX = ubi8
97+
build-ubi9: DOCKERFILE_SUFFIX = ubi9
8898

8999
# Use a generic build target to build the relevant images
90100
$(BUILD_TARGETS): build-%:
@@ -96,6 +106,5 @@ $(BUILD_TARGETS): build-%:
96106
--tag $(IMAGE) \
97107
--build-arg CUDA_SAMPLES_VERSION="$(CUDA_SAMPLES_VERSION)" \
98108
--build-arg SAMPLE_NAME=$(SAMPLE) \
99-
--build-arg CVE_UPDATES="$(CVE_UPDATES)" \
100109
-f $(DOCKERFILE) \
101110
$(CURDIR)

deployments/container/native-only.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
15+
PUSH_ON_BUILD ?= false
16+
ARCH ?= $(shell uname -m)
17+
DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/$(ARCH)
1618

1719
$(PUSH_TARGETS): push-%:
1820
$(DOCKER) tag "$(IMAGE)" "$(OUT_IMAGE)"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubuntu22.04 AS builder
16+
17+
ARG SAMPLE_NAME=nbody
18+
ENV SAMPLE_NAME=${SAMPLE_NAME}
19+
20+
ARG DEBIAN_FRONTEND=noninteractive
21+
RUN apt-get update && apt-get install -y --no-install-recommends \
22+
cuda-nvcc-12-6 \
23+
build-essential \
24+
g++ \
25+
curl \
26+
freeglut3-dev \
27+
libgl1-mesa-dev \
28+
libglu1-mesa-dev \
29+
&& \
30+
rm -rf /var/lib/apt/lists/*
31+
32+
WORKDIR /build
33+
34+
ARG TARGETARCH
35+
36+
ARG CUDA_SAMPLES_VERSION=v12.0
37+
RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/${CUDA_SAMPLES_VERSION} | \
38+
tar -xzvf - --strip-components=1 --wildcards */${SAMPLE_NAME}/* --wildcards */Common/* && \
39+
cd $(find /build/Samples -iname "${SAMPLE_NAME}") && \
40+
make build && \
41+
cp $(find /build/bin -iname "${SAMPLE_NAME}") /build/${SAMPLE_NAME}
42+
43+
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubuntu22.04
44+
ARG SAMPLE_NAME
45+
LABEL io.k8s.display-name="NVIDIA CUDA ${SAMPLE_NAME} sample"
46+
LABEL name="NVIDIA CUDA ${SAMPLE_NAME} sample"
47+
LABEL vendor="NVIDIA"
48+
LABEL version="1.0.0"
49+
LABEL release="N/A"
50+
LABEL summary="NVIDIA container to validate GPU support"
51+
LABEL description="See summary"
52+
53+
# The nbody sample requires libGL, libGLU, and libglut
54+
RUN apt-get update && apt-get install -y --no-install-recommends \
55+
freeglut3 \
56+
libgl1 \
57+
libglu1 \
58+
&& \
59+
rm -rf /var/lib/apt/lists/* || :
60+
61+
COPY ./LICENSE ./licenses/LICENSE
62+
63+
RUN mkdir -p /cuda-samples
64+
COPY --from=builder /build/${SAMPLE_NAME} /cuda-samples/${SAMPLE_NAME}
65+
66+
RUN ln -s /cuda-samples/${SAMPLE_NAME} /cuda-samples/sample
67+
ENTRYPOINT ["/cuda-samples/sample"]

0 commit comments

Comments
 (0)