From 7a6d8e2e8ef95f51e7014c557dc303d25bfac788 Mon Sep 17 00:00:00 2001 From: Guilherme Caponetto <638737+caponetto@users.noreply.github.com> Date: Tue, 23 Jul 2024 09:40:28 -0300 Subject: [PATCH] Combine RUN commands to reduce image size --- .../rocm/pytorch/ubi9-python-3.9/Dockerfile | 16 ++++++---------- .../rocm/tensorflow/ubi9-python-3.9/Dockerfile | 18 +++++++----------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/jupyter/rocm/pytorch/ubi9-python-3.9/Dockerfile b/jupyter/rocm/pytorch/ubi9-python-3.9/Dockerfile index ab0601d67..ca883c0fb 100644 --- a/jupyter/rocm/pytorch/ubi9-python-3.9/Dockerfile +++ b/jupyter/rocm/pytorch/ubi9-python-3.9/Dockerfile @@ -14,14 +14,10 @@ LABEL name="odh-notebook-jupyter-rocm-pytorch-ubi9-python-3.9" \ # Install Python packages and Jupyterlab extensions from Pipfile.lock COPY Pipfile.lock ./ -RUN echo "Installing softwares and packages" && \ - micropipenv install && \ - rm -f ./Pipfile.lock && \ - # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \ +RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock && \ + # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ - # Disable announcement plugin of jupyterlab \ - jupyter labextension disable "@jupyterlab/apputils-extension:announcements" - -# Fix permissions to support pip in Openshift environments -RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \ - fix-permissions /opt/app-root -P + # Disable announcement plugin of jupyterlab + jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \ + # Fix permissions to support pip in Openshift environments + chmod -R g+w /opt/app-root/lib/python3.9/site-packages && fix-permissions /opt/app-root -P diff --git a/jupyter/rocm/tensorflow/ubi9-python-3.9/Dockerfile b/jupyter/rocm/tensorflow/ubi9-python-3.9/Dockerfile index 116bee463..87acf24d2 100644 --- a/jupyter/rocm/tensorflow/ubi9-python-3.9/Dockerfile +++ b/jupyter/rocm/tensorflow/ubi9-python-3.9/Dockerfile @@ -14,14 +14,10 @@ LABEL name="odh-notebook-jupyter-rocm-tensorflow-ubi9-python-3.9" \ # Install Python packages and Jupyterlab extensions from Pipfile.lock COPY Pipfile.lock ./ -RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock - -# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y -RUN sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json - -# Disable announcement plugin of jupyterlab -RUN jupyter labextension disable "@jupyterlab/apputils-extension:announcements" - -# Fix permissions to support pip in Openshift environments -RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \ - fix-permissions /opt/app-root -P +RUN echo "Installing softwares and packages" && micropipenv install && rm -f ./Pipfile.lock && \ + # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y + sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \ + # Disable announcement plugin of jupyterlab + jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \ + # Fix permissions to support pip in Openshift environments + chmod -R g+w /opt/app-root/lib/python3.9/site-packages && fix-permissions /opt/app-root -P