Skip to content

Commit

Permalink
fix(build): reduce container image size (sustainable-computing-io#1336)
Browse files Browse the repository at this point in the history
This commit reduces container image size by
1. Removing `yum update` resulting in more reproducible builds
2. fixing installation of dcgm only when it is enabled

Signed-off-by: Sunil Thaha <[email protected]>
  • Loading branch information
sthaha authored Apr 10, 2024
1 parent 4e8abc8 commit 8112a90
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@ COPY . .
RUN make build VERSION=${VERSION}

FROM registry.access.redhat.com/ubi9:9.2
ARG INSTALL_DCGM
ARG INSTALL_DCGM=${INSTALL_DCGM:-""}
ARG INSTALL_DCGM=${INSTALL_DCGM:-"false"}
ARG TARGETARCH

RUN yum -y update

ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=utility
ENV NVIDIA_MIG_CONFIG_DEVICES=all
ENV NVIDIA_MIG_MONITOR_DEVICES=all
ENV NVIDIA_MIG_CONFIG_DEVICES=all

RUN INSTALL_PKGS=" \
libbpf \
" && \
yum install -y $INSTALL_PKGS

RUN if [ "$TARGETARCH" == "amd64" ]; then \
RUN if [[ "$TARGETARCH" == "amd64" ]]; then \
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm; \
yum install -y cpuid; \
if [[ ! -z "$INSTALL_DCGM" && "$INSTALL_DCGM" == "true" ]]; then \
if [[ "$INSTALL_DCGM" == "true" ]]; then \
dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo; \
yum install -y datacenter-gpu-manager; \
fi; \
Expand Down

0 comments on commit 8112a90

Please sign in to comment.