diff --git a/training/Makefile.common b/training/Makefile.common index b7ff2936..bdbb67e5 100644 --- a/training/Makefile.common +++ b/training/Makefile.common @@ -8,6 +8,7 @@ IMAGE_TAG ?= latest CONTAINER_TOOL ?= podman CONTAINER_TOOL_EXTRA_ARGS ?= +EXTRA_RPM_PACKAGES ?= ARCH ?= diff --git a/training/amd-bootc/Containerfile b/training/amd-bootc/Containerfile index caeef2e0..cbc3c013 100644 --- a/training/amd-bootc/Containerfile +++ b/training/amd-bootc/Containerfile @@ -2,7 +2,11 @@ FROM quay.io/centos-bootc/centos-bootc:stream9 ADD rocm.repo /etc/yum.repos.d/rocm.repo -RUN dnf install -y rocm-smi && dnf clean all +ARG EXTRA_RPM_PACKAGES='' +RUN dnf install -y \ + rocm-smi \ + ${EXTRA_RPM_PACKAGES} \ + && dnf clean all ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/instructlab-amd:latest" diff --git a/training/amd-bootc/Makefile b/training/amd-bootc/Makefile index a320ba25..66f6e4a4 100644 --- a/training/amd-bootc/Makefile +++ b/training/amd-bootc/Makefile @@ -14,5 +14,6 @@ bootc: prepare-files --tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \ --build-arg "INSTRUCTLAB_IMAGE=$(INSTRUCTLAB_IMAGE)" \ --build-arg "INSTRUCTLAB_IMAGE_ID=$(INSTRUCTLAB_IMAGE_ID)" \ + $(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \ $(FROM:%=--from=%) \ ${CONTAINER_TOOL_EXTRA_ARGS} . diff --git a/training/intel-bootc/Containerfile b/training/intel-bootc/Containerfile index df1a45ee..b2179ae3 100644 --- a/training/intel-bootc/Containerfile +++ b/training/intel-bootc/Containerfile @@ -47,6 +47,7 @@ RUN if [ "${OS_VERSION_MAJOR}" == "" ]; then \ FROM ${BASEIMAGE} ARG KERNEL_VERSION='' +ARG EXTRA_RPM_PACKAGES='' COPY --from=builder --chown=0:0 /tmp/habanalabs/lib/firmware/habanalabs/gaudi /lib/firmware/habanalabs/gaudi COPY --from=builder --chown=0:0 /tmp/habanalabs/lib/firmware/habanalabs/gaudi2 /lib/firmware/habanalabs/gaudi2 @@ -65,4 +66,6 @@ RUN if [ "${KERNEL_VERSION}" == "" ]; then \ && mkdir -p /lib/modules/${KERNEL_VERSION}.${TARGET_ARCH}/extra/ \ && mv /tmp/*.xz /lib/modules/${KERNEL_VERSION}.${TARGET_ARCH}/extra/ \ && chown root:root /lib/modules/${KERNEL_VERSION}.${TARGET_ARCH}/extra/habanalabs*.xz \ - && depmod -a ${KERNEL_VERSION}.${TARGET_ARCH} + && depmod -a ${KERNEL_VERSION}.${TARGET_ARCH} \ + && xargs --no-run-if-empty dnf install -y <<< "${EXTRA_RPM_PACKAGES}" \ + && dnf clean all diff --git a/training/intel-bootc/Makefile b/training/intel-bootc/Makefile index a01af317..411ee707 100644 --- a/training/intel-bootc/Makefile +++ b/training/intel-bootc/Makefile @@ -9,6 +9,7 @@ bootc: --file Containerfile \ --tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \ -v ${OUTDIR}:/run/.input:ro \ + $(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \ $(FROM:%=--build-arg BASEIMAGE=%) \ $(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \ $(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \ diff --git a/training/nvidia-bootc/Containerfile b/training/nvidia-bootc/Containerfile index 9375440b..d43bc002 100644 --- a/training/nvidia-bootc/Containerfile +++ b/training/nvidia-bootc/Containerfile @@ -82,6 +82,8 @@ ARG CUDA_VERSION='12.3.2' ARG TARGET_ARCH='' ENV TARGETARCH=${TARGET_ARCH} +ARG EXTRA_RPM_PACKAGES='' + # Disable vGPU version compability check by default ARG DISABLE_VGPU_VERSION_CHECK=true ENV DISABLE_VGPU_VERSION_CHECK=$DISABLE_VGPU_VERSION_CHECK @@ -118,6 +120,7 @@ RUN if [ "${TARGET_ARCH}" == "" ]; then \ cuda-cudart-${CUDA_DASHED_VERSION} \ nvidia-persistenced-${DRIVER_VERSION} \ nvidia-container-toolkit \ + ${EXTRA_RPM_PACKAGES} \ && if [ "$DRIVER_TYPE" != "vgpu" ] && [ "$TARGET_ARCH" != "arm64" ]; then \ versionArray=(${DRIVER_VERSION//./ }); \ DRIVER_BRANCH=${versionArray[0]}; \ diff --git a/training/nvidia-bootc/Makefile b/training/nvidia-bootc/Makefile index 352e5a57..3ff13afd 100644 --- a/training/nvidia-bootc/Makefile +++ b/training/nvidia-bootc/Makefile @@ -33,6 +33,7 @@ bootc: dtk check-sshkey prepare-files $(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \ $(OS_VERSION_MAJOR:%=--build-arg OS_VERSION_MAJOR=%) \ $(FROM:%=--build-arg BASEIMAGE=%) \ + $(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \ --build-arg DRIVER_TOOLKIT_IMAGE=${DRIVER_TOOLKIT_IMAGE} \ $(DRIVER_VERSION:%=--label driver-version=%) \ $(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \