From 9a63344de3cdc207737820764c9dd5633be36cd5 Mon Sep 17 00:00:00 2001 From: Enrique Belarte Luque Date: Mon, 23 Sep 2024 11:31:48 -0500 Subject: [PATCH] Some fixes to intel Containerfile Not all devel packages can be removed as they're dependencies Signed-off-by: Enrique Belarte Luque --- training/intel-bootc/Containerfile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/training/intel-bootc/Containerfile b/training/intel-bootc/Containerfile index 06797c36..cfc8131e 100644 --- a/training/intel-bootc/Containerfile +++ b/training/intel-bootc/Containerfile @@ -85,7 +85,7 @@ COPY --from=libbuilder /opt/habanalabs/libfabric-1.20.0 /opt/habanalabs/libfabri COPY --chmod=755 scripts/os_dependencies.sh /tmp/ #Install python3.11 and other build stuff -RUN /tmp/os_dependencies.sh \ +RUN mv /etc/selinux /etc/selinux.tmp \ && dnf install -y \ python3.11 \ python3.11-pip \ @@ -94,7 +94,9 @@ RUN /tmp/os_dependencies.sh \ make \ gcc-c++ \ unzip \ - && dnf clean all && rm -rf /var/cache/yum + && dnf clean all && rm -rf /var/cache/yum \ + && /tmp/os_dependencies.sh \ + && mv /etc/selinux.tmp /etc/selinux #Build ninja-build RUN git clone https://github.com/ninja-build/ninja.git \ @@ -106,6 +108,7 @@ RUN . /etc/os-release \ && export OS_VERSION_MAJOR=$(echo ${VERSION} | cut -d'.' -f 1) \ && export KERNEL_VERSION=$(rpm -q --qf '%{VERSION}-%{RELEASE}' kernel-core) \ && export TARGET_ARCH=$(rpm -q --qf '%{ARCH}' kernel-core) \ + && mv /etc/selinux /etc/selinux.tmp \ && dnf -y update --exclude=kernel* --exclude=microcode_ctl \ && dnf install -y --nodocs --allowerasing --best \ libogg-devel \ @@ -121,13 +124,10 @@ RUN . /etc/os-release \ habanalabs-qual-${DRIVER_VERSION}.el9 \ habanalabs-firmware-odm-${DRIVER_VERSION}.el9 \ && rm -f /etc/yum.repos.d/habanalabs.repo && rm -f /etc/yum.repos.d/habana.repo \ - && dnf remove -y \ + && dnf remove -y --noautoremove \ python3.11-devel \ - libogg-devel \ - opusfile-devel \ - sox-devel \ - libnl3-devel \ && dnf clean all && rm -rf /var/cache/yum \ + && mv /etc/selinux.tmp /etc/selinux \ && mv /tmp/extra /usr/lib/modules/${KERNEL_VERSION}.${TARGET_ARCH} \ && echo "softdep habanalabs post: habanalabs_ib" > /etc/modprobe.d/habanalabs_ib_dep.conf \ && depmod -a ${KERNEL_VERSION}.${TARGET_ARCH} \ @@ -135,10 +135,13 @@ RUN . /etc/os-release \ RUN python3.11 -m pip install pip==23.3.1 setuptools==67.3.3 wheel==0.38.4 habana_media_loader=="1.17.1.40" -RUN dnf install -y ${EXTRA_RPM_PACKAGES} \ +RUN mv /etc/selinux /etc/selinux.tmp \ + && dnf install -y ${EXTRA_RPM_PACKAGES} \ + skopeo \ cloud-init \ rsync \ && dnf clean all \ + && mv /etc/selinux.tmp /etc/selinux \ && ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants @@ -158,8 +161,13 @@ RUN grep -q /usr/lib/containers/storage /etc/containers/storage.conf || \ /etc/containers/storage.conf COPY duplicated/ilab-wrapper/ilab /usr/bin/ilab RUN chmod +x /usr/bin/ilab -ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/instructlab-intel:latest" +ARG INSTRUCTLAB_IMAGE="quay.io/ai-lab/intel-instructlab" ARG INSTRUCTLAB_IMAGE_PULL_SECRET="instructlab-intel-pull" +RUN for i in /usr/bin/ilab*; do \ + sed -i 's/__REPLACE_TRAIN_DEVICE__/hpu/' $i; \ + sed -i "s%__REPLACE_IMAGE_NAME__%${INSTRUCTLAB_IMAGE}%" $i; \ + done + # Added for running as an OCI Container to prevent Overlay on Overlay issues. VOLUME /var/lib/containers # Prepull the instructlab image @@ -173,4 +181,3 @@ RUN --mount=type=secret,id=${INSTRUCTLAB_IMAGE_PULL_SECRET}/.dockerconfigjson \ IID=$(sudo podman --root /usr/lib/containers/storage pull ${INSTRUCTLAB_IMAGE}); \ fi RUN podman system reset --force 2>/dev/null -