@@ -25,12 +25,21 @@ COPY --from=ubi-repos /etc/yum.repos.d/ubi.repo /etc/yum.repos.d/ubi.repo
2525# Problem: The operation would result in removing the following protected packages: systemd
2626# (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)
2727# Solution: --best --skip-broken does not work either, so use --nobest
28- RUN dnf -y upgrade --refresh --nobest --skip-broken --nodocs --noplugins --setopt=install_weak_deps=0 --setopt=keepcache=0 \
29- && dnf clean all -y
28+ RUN /bin/bash <<'EOF'
29+ set -Eeuxo pipefail
30+ dnf -y upgrade --refresh --nobest --skip-broken --nodocs --noplugins --setopt=install_weak_deps=0 --setopt=keepcache=0
31+ dnf clean all -y
32+ EOF
33+
3034# upgrade first to avoid fixable vulnerabilities end
3135
3236# Install useful OS packages
33- RUN dnf install -y perl mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
37+ RUN /bin/bash <<'EOF'
38+ set -Eeuxo pipefail
39+ dnf install -y perl mesa-libGL skopeo
40+ dnf clean all
41+ rm -rf /var/cache/yum
42+ EOF
3443
3544# Other apps and tools installed as default user
3645USER 1001
@@ -40,10 +49,14 @@ RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12"
4049# Install micropipenv and uv to deploy packages from requirements.txt end
4150
4251# Install the oc client begin
43- RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
44- -o /tmp/openshift-client-linux.tar.gz && \
45- tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
46- rm -f /tmp/openshift-client-linux.tar.gz
52+ RUN /bin/bash <<'EOF'
53+ set -Eeuxo pipefail
54+ curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
55+ -o /tmp/openshift-client-linux.tar.gz
56+ tar -xzvf /tmp/openshift-client-linux.tar.gz oc
57+ rm -f /tmp/openshift-client-linux.tar.gz
58+ EOF
59+
4760# Install the oc client end
4861
4962########################
@@ -69,31 +82,43 @@ USER 1001
6982COPY ${MINIMAL_SOURCE_CODE}/pylock.toml ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
7083
7184# Install Python dependencies from Pipfile.lock file
72- RUN echo "Installing softwares and packages" && \
73- # This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
74- # we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
75- uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./pylock.toml && \
76- # Disable announcement plugin of jupyterlab \
77- jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
78- # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
79- sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
80- # copy jupyter configuration
81- cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \
82- # Apply JupyterLab addons \
83- /opt/app-root/bin/utils/addons/apply.sh
84-
85- # Fix permissions to support pip in Openshift environments \
85+ RUN /bin/bash <<'EOF'
86+ set -Eeuxo pipefail
87+ echo "Installing softwares and packages"
88+ # This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
89+ # we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
90+ uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./pylock.toml
91+ # Disable announcement plugin of jupyterlab
92+ jupyter labextension disable "@jupyterlab/apputils-extension:announcements"
93+ # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y
94+ sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json
95+ # copy jupyter configuration
96+ cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter
97+ # Apply JupyterLab addons
98+ /opt/app-root/bin/utils/addons/apply.sh
99+ EOF
100+
101+ # Fix permissions to support pip in Openshift environments
86102USER 0
87- RUN chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
88- fix-permissions /opt/app-root -P
103+ RUN /bin/bash <<'EOF'
104+ set -Eeuxo pipefail
105+ chmod -R g+w /opt/app-root/lib/python3.12/site-packages
106+ fix-permissions /opt/app-root -P
107+ EOF
108+
89109USER 1001
90110
91111# Workaround for https://issues.redhat.com/browse/AIPCC-8152
92112ENV ROCM_PATH=/opt/rocm
93113# Workaround for 2.25.2 issue https://issues.redhat.com/browse/RHAIENG-1638 missing rocm package in older AIPCC builds
94114# https://issues.redhat.com/browse/AIPCC-5882
95115USER 0
96- RUN dnf --setopt=reposdir=/etc/rhaipcc/repos.d --enablerepo="external-amd-rocm-*" install -y rocm-device-libs && dnf clean all
116+ RUN /bin/bash <<'EOF'
117+ set -Eeuxo pipefail
118+ dnf --setopt=reposdir=/etc/rhaipcc/repos.d --enablerepo="external-amd-rocm-*" install -y rocm-device-libs
119+ dnf clean all
120+ EOF
121+
97122USER 1001
98123
99124WORKDIR /opt/app-root/src
0 commit comments