diff --git a/training/amd/Containerfile b/training/amd/Containerfile index b262b2fb..41ca08de 100644 --- a/training/amd/Containerfile +++ b/training/amd/Containerfile @@ -5,12 +5,24 @@ ADD rocm.repo /etc/yum.repos.d/rocm.repo # Enable CRB repo for CentOS. For RHEL, it should be enabled on the build host RUN source /etc/os-release \ && export OS_ID="$ID" \ - && if [ "$OS_ID" == "centos" ]; then \ - curl -L https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -o /tmp/epel-release-latest-9.noarch.rpm \ - && rpm -ivh /tmp/epel-release-latest-9.noarch.rpm \ - && rm -f /tmp/epel-release-latest-9.noarch.rpm \ + && if [ "$OS_ID" == "centos" ] || [ "$OS_ID" == "rhel" ]; then \ + rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \ && dnf install -y 'dnf-command(config-manager)' \ && crb enable ;\ fi RUN dnf install -y rocm && dnf clean all + +ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/instructlab-amd:latest" + +# Setup /usr/lib/containers/storage as an additional store for images. +# Remove once the base images have this set by default. +RUN sed -i -e '/additionalimage.*/a "/usr/lib/containers/storage",' \ + /etc/containers/storage.conf + +# Added for running as an OCI Container to prevent Overlay on Overlay issues. +VOLUME /var/lib/containers + +# Prepull the instructlab image + +RUN podman pull --arch=${TARGETARCH} --root /usr/lib/containers/storage ${INSTRUCTLAB_IMAGE} diff --git a/training/amd/Makefile b/training/amd/Makefile index ad4fd866..66ff4ce6 100644 --- a/training/amd/Makefile +++ b/training/amd/Makefile @@ -11,7 +11,13 @@ CONTAINER_TOOL_EXTRA_ARGS ?= .PHONY: image image: "${CONTAINER_TOOL}" build \ + --security-opt label=disable \ + --cap-add SYS_ADMIN \ --file Containerfile \ --tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \ $(FROM:%=--from=%) \ ${CONTAINER_TOOL_EXTRA_ARGS} + +.PHONY: push +push: + podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" diff --git a/training/intel/Makefile b/training/intel/Makefile index 684ed2f2..40fdb511 100644 --- a/training/intel/Makefile +++ b/training/intel/Makefile @@ -20,3 +20,7 @@ image: $(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \ $(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \ ${CONTAINER_TOOL_EXTRA_ARGS} + +.PHONY: push +push: + podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" diff --git a/training/nvidia/Containerfile b/training/nvidia/Containerfile index c37a2207..e7df6245 100644 --- a/training/nvidia/Containerfile +++ b/training/nvidia/Containerfile @@ -122,3 +122,17 @@ RUN if [ "${TARGET_ARCH}" == "" ]; then \ && dnf clean all \ && ln -s /usr/lib/systemd/system/nvidia-toolkit-firstboot.service /usr/lib/systemd/system/basic.target.wants/nvidia-toolkit-firstboot.service \ && echo "blacklist nouveau" > /etc/modprobe.d/blacklist_nouveau.conf + +ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/instructlab-nvidia:latest" + +# Setup /usr/lib/containers/storage as an additional store for images. +# Remove once the base images have this set by default. +RUN sed -i -e '/additionalimage.*/a "/usr/lib/containers/storage",' \ + /etc/containers/storage.conf + +# Added for running as an OCI Container to prevent Overlay on Overlay issues. +VOLUME /var/lib/containers + +# Prepull the instructlab image + +RUN podman pull --arch=${TARGETARCH} --root /usr/lib/containers/storage ${INSTRUCTLAB_IMAGE} diff --git a/training/nvidia/Makefile b/training/nvidia/Makefile index 0e9b8cd7..90a51bdc 100644 --- a/training/nvidia/Makefile +++ b/training/nvidia/Makefile @@ -32,6 +32,8 @@ dtk: . image: "${CONTAINER_TOOL}" build \ + --security-opt label=disable \ + --cap-add SYS_ADMIN \ $(ARCH:%=--platform linux/%) \ --file Containerfile \ --tag "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}" \ @@ -43,3 +45,7 @@ image: $(CUDA_VERSION:%=--build-arg CUDA_VERSION=%) \ ${CONTAINER_TOOL_EXTRA_ARGS} \ . + +.PHONY: push +push: + podman push "${REGISTRY}/${REGISTRY_ORG}/${IMAGE_NAME}:${IMAGE_TAG}"