Skip to content

Commit 0ea49e4

Browse files
committed
Switch to distroless golang image
This also removes the cleanup scripts. Signed-off-by: Evan Lezar <[email protected]>
1 parent 337e940 commit 0ea49e4

File tree

3 files changed

+9
-102
lines changed

3 files changed

+9
-102
lines changed

deployments/container/Dockerfile

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ RUN set -eux; \
3333
wget -nv -O - https://storage.googleapis.com/golang/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz \
3434
| tar -C /usr/local -xz
3535

36-
ENV GOPATH /go
37-
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
36+
ENV GOPATH=/go
37+
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
3838

3939
WORKDIR /build
4040
COPY . .
@@ -50,22 +50,11 @@ FROM redhat/ubi9-minimal:latest AS minimal
5050
RUN rpm -qa --queryformat='^%{NAME}-\[0-9\].*\.%{ARCH}$\n' | sort -u > /tmp/package-names.minimal
5151
RUN rpm -qa | sort -u > /tmp/package-list.minimal
5252

53-
# We define the following image as a base image and remove unneeded packages.
54-
FROM nvcr.io/nvidia/cuda:12.9.0-base-ubi9 AS base
53+
FROM nvcr.io/nvidia/distroless/go:v3.1.9-dev
5554

56-
WORKDIR /cleanup
57-
58-
COPY --from=minimal /tmp/package-names.minimal package-names.minimal
59-
COPY --from=minimal /tmp/package-list.minimal package-list.minimal
60-
COPY deployments/container/cleanup/* .
61-
62-
RUN ./cleanup.sh
63-
64-
WORKDIR /
65-
66-
# We use the base images constructed above.
67-
# TODO: We will move to a shared base image once this implementation has been stabilized.
68-
FROM base
55+
USER 0:0
56+
SHELL ["/busybox/sh", "-c"]
57+
RUN ln -s /busybox/sh /bin/sh
6958

7059
ENV NVIDIA_DISABLE_REQUIRE="true"
7160
ENV NVIDIA_VISIBLE_DEVICES=all
@@ -83,7 +72,7 @@ LABEL release="N/A"
8372
LABEL summary="NVIDIA device plugin for Kubernetes"
8473
LABEL description="See summary"
8574

86-
RUN mkdir /licenses && mv /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
75+
COPY LICENSE /licenses/
8776

8877
COPY --from=build /artifacts/config-manager /usr/bin/config-manager
8978
COPY --from=build /artifacts/gpu-feature-discovery /usr/bin/gpu-feature-discovery

deployments/container/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ OUT_IMAGE_TAG = $(OUT_IMAGE_VERSION)-$(DIST)
3838
OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_TAG)
3939

4040
##### Public rules #####
41-
DEFAULT_PUSH_TARGET := ubi9
41+
DEFAULT_PUSH_TARGET := image
4242
DISTRIBUTIONS = $(DEFAULT_PUSH_TARGET)
4343

4444
IMAGE_TARGETS := $(patsubst %,image-%,$(DISTRIBUTIONS))
@@ -65,11 +65,8 @@ ifeq ($(PUSH_MULTIPLE_TAGS),true)
6565
push-$(DEFAULT_PUSH_TARGET): push-short
6666
endif
6767

68-
push-%: DIST = $(*)
69-
push-short: DIST = $(DEFAULT_PUSH_TARGET)
7068

71-
build-%: DIST = $(*)
72-
build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile
69+
DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile
7370

7471
# Use a generic build target to build the relevant images
7572
$(IMAGE_TARGETS): image-%:
@@ -90,7 +87,6 @@ $(IMAGE_TARGETS): image-%:
9087
.PHONY: build
9188
build: $(DEFAULT_PUSH_TARGET)
9289
$(DEFAULT_PUSH_TARGET): build-$(DEFAULT_PUSH_TARGET)
93-
$(DEFAULT_PUSH_TARGET): DIST = $(DEFAULT_PUSH_TARGET)
9490

9591
REGCTL ?= regctl
9692
$(PUSH_TARGETS): push-%:

deployments/container/cleanup/cleanup.sh

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)