Skip to content

Commit

Permalink
Combine RUN commands to reduce image size
Browse files Browse the repository at this point in the history
  • Loading branch information
caponetto committed Jul 23, 2024
1 parent bc3b27e commit 7a6d8e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
16 changes: 6 additions & 10 deletions jupyter/rocm/pytorch/ubi9-python-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 7 additions & 11 deletions jupyter/rocm/tensorflow/ubi9-python-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7a6d8e2

Please sign in to comment.