Skip to content

Commit

Permalink
feat: download RPM metadata in build stage to lower bandwidth usage i…
Browse files Browse the repository at this point in the history
…n final stage (#65)
  • Loading branch information
joshua-stone authored Mar 9, 2023
1 parent 581f1fa commit 95d9c13
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,30 @@ A container build can be invoked by simply running:

```
$ podman build \
--file Containerfile \
--file build.Containerfile \
--tag build-test:latest
$ podman build \
--file install.Containerfile \
--tag install-test:latest
```

Or to specify the version of Fedora and/or Nvidia driver:

```
$ podman build \
--build-arg IMAGE_NAME=silverblue \
--build-arg SOURCE_IMAGE=silverblue \
--build-arg FEDORA_MAJOR_VERSION=37 \
--build-arg NVIDIA_MAJOR_VERSION=525 \
--file Containerfile \
--file build.Containerfile \
--tag build-test:37-525
$ podman build \
--build-arg IMAGE_NAME=silverblue \
--build-arg FEDORA_MAJOR_VERSION=37 \
--build-arg NVIDIA_MAJOR_VERSION=525 \
--build-arg AKMODS_CACHE=build-test \
--build-arg AKMODS_VERSION=37 \
--file install.Containerfile \
--tag build-test:latest
```

Expand Down
3 changes: 3 additions & 0 deletions build.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ ADD ublue-os-nvidia-addons.spec /tmp/ublue-os-nvidia-addons/ublue-os-nvidia-addo
ADD https://nvidia.github.io/nvidia-docker/rhel9.0/nvidia-docker.repo \
/tmp/ublue-os-nvidia-addons/rpmbuild/SOURCES/nvidia-container-runtime.repo

ADD https://nvidia.github.io/nvidia-docker/rhel9.0/nvidia-docker.repo \
/etc/yum.repos.d/nvidia-container-runtime.repo

ADD files/etc/nvidia-container-runtime/config-rootless.toml \
/tmp/ublue-os-nvidia-addons/rpmbuild/SOURCES/config-rootless.toml
ADD https://raw.githubusercontent.com/NVIDIA/dgx-selinux/master/bin/RHEL9/nvidia-container.pp \
Expand Down
18 changes: 7 additions & 11 deletions install.Containerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
ARG IMAGE_NAME="${IMAGE_NAME:-silverblue}"
ARG BASE_IMAGE="ghcr.io/ublue-os/${IMAGE_NAME}-main"
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-37}"
ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION:-525}"
ARG AKMODS_VERSION="${AKMODS_VERSION:-37}"
ARG IMAGE_NAME=silverblue
ARG BASE_IMAGE=ghcr.io/ublue-os/${IMAGE_NAME}-main
ARG FEDORA_MAJOR_VERSION=37

FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION}

ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION}"
ARG NVIDIA_MAJOR_VERSION="${NVIDIA_MAJOR_VERSION}"
ARG AKMODS_VERSION="${AKMODS_VERSION}"

ARG BUILDER_IMAGE="ghcr.io/ublue-os/akmods-nvidia:${AKMODS_VERSION}-${NVIDIA_MAJOR_VERSION}"
ARG IMAGE_NAME="${IMAGE_NAME}"
ARG AKMODS_CACHE="ghcr.io/ublue-os/akmods-nvidia"
ARG AKMODS_VERSION="37"
ARG NVIDIA_MAJOR_VERSION="525"

COPY --from=${BUILDER_IMAGE} / .
COPY --from=${AKMODS_CACHE}:${AKMODS_VERSION}-${NVIDIA_MAJOR_VERSION} / .

COPY install.sh /tmp/install.sh
COPY post-install.sh /tmp/post-install.sh
Expand Down

0 comments on commit 95d9c13

Please sign in to comment.