Skip to content

Commit

Permalink
TOFIX: packages in image
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Lezar <elezar@nvidia.com>
  • Loading branch information
elezar committed Jul 12, 2024
1 parent fce56f9 commit 09e4268
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions deployments/container/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,59 @@ COPY . .
# and not `cmd`.
RUN GOPATH=/artifacts go install -ldflags="-s -w -X 'main.Version=${VERSION}'" ./tools/...

FROM nvidia/cuda:12.5.0-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_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


FROM nvidia/cuda:12.5.0-base-ubi8 AS rpmpackages
RUN dnf install -y cpio

ARG TARGETARCH
ARG PACKAGE_DIST_RPM=centos7
ENV PACKAGE_ARCH ${TARGETARCH}

WORKDIR /tmp
COPY --from=packaging /artifacts/packages/${PACKAGE_DIST_RPM}/* /tmp/rpm-packages/

RUN PACKAGE_ARCH=${PACKAGE_ARCH/amd64/x86_64} \
for p in $(ls /tmp/rpm-packages/${PACKAGE_ARCH}/*.rpm); do rpm2cpio $p | cpio -idmv -D /artifacts/rpm/; done

FROM nvidia/cuda:12.5.0-base-ubuntu20.04 AS debpackages

ARG TARGETARCH
ARG PACKAGE_DIST_DEB=ubuntu18.04
ENV PACKAGE_ARCH ${TARGETARCH}

WORKDIR /tmp
COPY --from=packaging /artifacts/packages/${PACKAGE_DIST_DEB}/* /tmp/deb-packages/

RUN for p in $(ls /tmp/deb-packages/${PACKAGE_ARCH}/*.deb); do dpkg-deb -xv $p /artifacts/deb/; done

FROM nvidia/cuda:12.5.0-base-ubi8

COPY --from=rpmpackages /artifacts/rpm /artifacts/rpm
COPY --from=debpackages /artifacts/deb /artifacts/deb

ENV NVIDIA_DISABLE_REQUIRE="true"
ENV NVIDIA_VISIBLE_DEVICES=void
ENV NVIDIA_DRIVER_CAPABILITIES=utility
Expand Down

0 comments on commit 09e4268

Please sign in to comment.