1- #########################
2- # configuration args #
3- #########################
4- ARG BASE_IMAGE
5-
6- # External image alias for UBI repository configuration
7- FROM registry.access.redhat.com/ubi9/ubi AS ubi-repos
8-
9- ############################
10- # Stage 1: PDF Tool Build #
11- ############################
12- FROM registry.access.redhat.com/ubi9/python-312:latest AS pdf-builder
13-
14- WORKDIR /opt/app-root/bin
15-
16- # OS Packages needs to be installed as root
17- USER 0
18-
19- # Copy scripts
20- COPY jupyter/utils/install_texlive.sh ./install_texlive.sh
21- COPY jupyter/utils/install_pandoc.sh ./install_pandoc.sh
22- RUN chmod +x install_texlive.sh install_pandoc.sh
23-
24- RUN ./install_texlive.sh
25- RUN ./install_pandoc.sh
26-
27- ####################
28- # cpu-base #
29- ####################
30- FROM ${BASE_IMAGE} AS cpu-base
31-
32- WORKDIR /opt/app-root/bin
1+ FROM quay.io/aipcc/base-images/cpu:3.0-1761652019 AS cpu-base
332
343# OS Packages needs to be installed as root
354USER 0
@@ -50,75 +19,4 @@ RUN dnf -y upgrade --refresh --nobest --skip-broken --nodocs --noplugins --setop
5019# Install useful OS packages
5120RUN dnf install -y perl mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
5221
53- # Other apps and tools installed as default user
54- USER 1001
55-
56- # Install micropipenv and uv to deploy packages from requirements.txt begin
57- RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12"
58- # Install micropipenv and uv to deploy packages from requirements.txt end
59-
60- # Install the oc client begin
61- RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
62- -o /tmp/openshift-client-linux.tar.gz && \
63- tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
64- rm -f /tmp/openshift-client-linux.tar.gz
65- # Install the oc client end
66-
67- ####################
68- # jupyter-minimal #
69- ####################
70- FROM cpu-base AS jupyter-minimal
71-
72- ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
73- ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
74-
75- LABEL name="odh-notebook-jupyter-minimal-ubi9-python-3.12" \
76- summary="Minimal Jupyter notebook image for ODH notebooks" \
77- description="Minimal Jupyter notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
78- io.k8s.display-name="Minimal Jupyter notebook image for ODH notebooks" \
79- io.k8s.description="Minimal Jupyter notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
80- authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
81- io.openshift.build.commit.ref="main" \
82- io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/minimal/ubi9-python-3.12" \
83- io.openshift.build.image="quay.io/opendatahub/workbench-images:jupyter-minimal-ubi9-python-3.12"
84-
85- WORKDIR /opt/app-root/bin
86-
87- COPY ${JUPYTER_REUSABLE_UTILS} utils/
88-
89- USER 0
90-
91- # Dependencies for PDF export begin
92- RUN --mount=type=cache,from=pdf-builder,source=/usr/local/,target=/pdf_builder/,rw \
93- bash -c ' \
94- if [[ "$(uname -m)" == "ppc64le" ]]; then \
95- cp -r /pdf_builder/texlive /usr/local/; \
96- cp -r /pdf_builder/pandoc /usr/local/; \
97- else \
98- ./utils/install_pdf_deps.sh; \
99- fi'
100-
10122USER 1001
102-
103- COPY ${MINIMAL_SOURCE_CODE}/pylock.toml ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
104-
105- # Install Python dependencies from requirements.txt file
106- RUN echo "Installing softwares and packages" && \
107- # This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
108- # we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
109- uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./pylock.toml && \
110- # Disable announcement plugin of jupyterlab \
111- jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
112- # Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
113- sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
114- # copy jupyter configuration
115- cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \
116- # Fix permissions to support pip in Openshift environments \
117- chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
118- fix-permissions /opt/app-root -P && \
119- # Apply JupyterLab addons \
120- /opt/app-root/bin/utils/addons/apply.sh
121-
122- WORKDIR /opt/app-root/src
123-
124- ENTRYPOINT ["start-notebook.sh"]
0 commit comments