Skip to content

Commit

Permalink
Some fixes to intel Containerfile
Browse files Browse the repository at this point in the history
Not all devel packages can be removed as they're dependencies

Signed-off-by: Enrique Belarte Luque <[email protected]>
  • Loading branch information
enriquebelarte committed Sep 23, 2024
1 parent f285961 commit 9a63344
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions training/intel-bootc/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand All @@ -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 \
Expand All @@ -121,24 +124,24 @@ 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} \
&& rm -rf tmp/*

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


Expand All @@ -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
Expand All @@ -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

0 comments on commit 9a63344

Please sign in to comment.