Skip to content

Commit 73437da

Browse files
Merge pull request #213 from e0ne/distoless
feat: Use distroless base image
2 parents 8e95f97 + 1a328cb commit 73437da

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Dockerfile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,25 @@ WORKDIR /usr/src/k8s-rdma-shared-dp
2929
RUN make clean && \
3030
make build
3131

32-
FROM nvcr.io/nvidia/doca/doca:3.1.0-base-rt-host
32+
FROM alpine:3 AS pkgs
33+
RUN apk add --no-cache hwdata-pci=0.395-r0 kmod=34.2-r0
34+
35+
36+
FROM nvcr.io/nvidia/distroless/go:v3.1.12-dev
37+
38+
# hadolint ignore=DL3002
39+
USER 0:0
40+
41+
SHELL ["/busybox/sh", "-c"]
42+
# hadolint ignore=DL4005
43+
RUN ln -s /busybox/sh /bin/sh
44+
3345
COPY --from=builder /usr/src/k8s-rdma-shared-dp/build/k8s-rdma-shared-dp /bin/
3446
COPY . /src
3547

36-
RUN apt-get update && apt-get install -y --no-install-recommends kmod=29-1ubuntu1 && \
37-
rm -rf /var/lib/apt/lists/*
48+
RUN mkdir -p /usr/share/hwdata
49+
COPY --from=pkgs /usr/share/hwdata/pci.ids /usr/share/hwdata/pci.ids
50+
COPY --from=pkgs /sbin/lsmod /sbin/lsmod
3851

3952
LABEL io.k8s.display-name="RDMA Shared Device Plugin"
4053

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ test-coverage: test-coverage-tools | ; $(info running coverage tests...) @ ## R
110110
# Container image
111111
.PHONY: image ubi-image
112112
image: | ; $(info Building Docker image...) ## Build conatiner image
113-
$(IMAGE_BUILDER) build --progress=plain -t $(TAG) -f $(DOCKERFILE) GOPROXY="$(GOPROXY)" $(CURDIR) $(IMAGE_BUILD_OPTS)
113+
$(IMAGE_BUILDER) build --progress=plain -t $(TAG) -f $(DOCKERFILE) --build-arg GOPROXY="$(GOPROXY)" $(CURDIR) $(IMAGE_BUILD_OPTS)
114114

115115
ubi-image: DOCKERFILE=$(CURDIR)/Dockerfile.ubi
116116
ubi-image: TAG=mellanox/k8s-rdma-shared-dev-plugin-ubi

0 commit comments

Comments
 (0)