Skip to content

Commit 7d8b859

Browse files
committed
creating jupyter minimal python 3.12 image
1 parent e15bb0c commit 7d8b859

File tree

11 files changed

+3860
-0
lines changed

11 files changed

+3860
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
####################
2+
# base #
3+
####################
4+
FROM registry.access.redhat.com/ubi9/python-312:latest AS base
5+
6+
WORKDIR /opt/app-root/bin
7+
8+
# OS Packages needs to be installed as root
9+
USER 0
10+
11+
# Install useful OS packages
12+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
13+
14+
# Other apps and tools installed as default user
15+
USER 1001
16+
17+
# Install micropipenv to deploy packages from Pipfile.lock
18+
RUN pip install --no-cache-dir -U "micropipenv[toml]"
19+
20+
# Install the oc client
21+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
22+
-o /tmp/openshift-client-linux.tar.gz && \
23+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
24+
rm -f /tmp/openshift-client-linux.tar.gz
25+
26+
####################
27+
# jupyter-minimal #
28+
####################
29+
FROM base AS jupyter-minimal
30+
31+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
32+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
33+
34+
LABEL name="odh-notebook-jupyter-minimal-ubi9-python-3.12" \
35+
summary="Minimal Jupyter notebook image for ODH notebooks" \
36+
description="Minimal Jupyter notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
37+
io.k8s.display-name="Minimal Jupyter notebook image for ODH notebooks" \
38+
io.k8s.description="Minimal Jupyter notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
39+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
40+
io.openshift.build.commit.ref="main" \
41+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/minimal/ubi9-python-3.12" \
42+
io.openshift.build.image="quay.io/opendatahub/workbench-images:jupyter-minimal-ubi9-python-3.12"
43+
44+
WORKDIR /opt/app-root/bin
45+
46+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
47+
48+
COPY ${MINIMAL_SOURCE_CODE}/Pipfile.lock ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
49+
50+
# Install Python dependencies from Pipfile.lock file
51+
RUN echo "Installing softwares and packages" && \
52+
micropipenv install && \
53+
rm -f ./Pipfile.lock && \
54+
# Disable announcement plugin of jupyterlab \
55+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
56+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
57+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
58+
# Fix permissions to support pip in Openshift environments \
59+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
60+
fix-permissions /opt/app-root -P && \
61+
# Apply JupyterLab addons \
62+
/opt/app-root/bin/utils/addons/apply.sh
63+
64+
WORKDIR /opt/app-root/src
65+
66+
ENTRYPOINT ["start-notebook.sh"]
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
####################
2+
# base #
3+
####################
4+
FROM registry.access.redhat.com/ubi9/python-312:latest AS base
5+
6+
WORKDIR /opt/app-root/bin
7+
8+
# OS Packages needs to be installed as root
9+
USER 0
10+
11+
# Install useful OS packages
12+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
13+
14+
# Other apps and tools installed as default user
15+
USER 1001
16+
17+
# Install micropipenv to deploy packages from Pipfile.lock
18+
RUN pip install --no-cache-dir -U "micropipenv[toml]"
19+
20+
# Install the oc client
21+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
22+
-o /tmp/openshift-client-linux.tar.gz && \
23+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
24+
rm -f /tmp/openshift-client-linux.tar.gz
25+
26+
####################
27+
# cuda-base #
28+
####################
29+
FROM base AS cuda-base
30+
31+
ARG CUDA_SOURCE_CODE=cuda
32+
33+
# Install CUDA base from:
34+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/base/Dockerfile
35+
USER 0
36+
WORKDIR /opt/app-root/bin
37+
38+
ENV NVARCH=x86_64
39+
ENV NVIDIA_REQUIRE_CUDA="cuda>=12.6 brand=unknown,driver>=470,driver<471 brand=grid,driver>=470,driver<471 brand=tesla,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=vapps,driver>=470,driver<471 brand=vpc,driver>=470,driver<471 brand=vcs,driver>=470,driver<471 brand=vws,driver>=470,driver<471 brand=cloudgaming,driver>=470,driver<471 brand=unknown,driver>=535,driver<536 brand=grid,driver>=535,driver<536 brand=tesla,driver>=535,driver<536 brand=nvidia,driver>=535,driver<536 brand=quadro,driver>=535,driver<536 brand=quadrortx,driver>=535,driver<536 brand=nvidiartx,driver>=535,driver<536 brand=vapps,driver>=535,driver<536 brand=vpc,driver>=535,driver<536 brand=vcs,driver>=535,driver<536 brand=vws,driver>=535,driver<536 brand=cloudgaming,driver>=535,driver<536 brand=unknown,driver>=550,driver<551 brand=grid,driver>=550,driver<551 brand=tesla,driver>=550,driver<551 brand=nvidia,driver>=550,driver<551 brand=quadro,driver>=550,driver<551 brand=quadrortx,driver>=550,driver<551 brand=nvidiartx,driver>=550,driver<551 brand=vapps,driver>=550,driver<551 brand=vpc,driver>=550,driver<551 brand=vcs,driver>=550,driver<551 brand=vws,driver>=550,driver<551 brand=cloudgaming,driver>=550,driver<551"
40+
ENV NV_CUDA_CUDART_VERSION=12.6.77-1
41+
42+
COPY ${CUDA_SOURCE_CODE}/cuda.repo-x86_64 /etc/yum.repos.d/cuda.repo
43+
COPY ${CUDA_SOURCE_CODE}/NGC-DL-CONTAINER-LICENSE /
44+
45+
RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
46+
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/rhel9/${NVARCH}/D42D0685.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
47+
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
48+
49+
ENV CUDA_VERSION=12.6.3
50+
51+
# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
52+
RUN yum upgrade -y && yum install -y \
53+
cuda-cudart-12-6-${NV_CUDA_CUDART_VERSION} \
54+
cuda-compat-12-6 \
55+
&& yum clean all \
56+
&& rm -rf /var/cache/yum/*
57+
58+
# nvidia-docker 1.0
59+
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
60+
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
61+
62+
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
63+
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64
64+
65+
# nvidia-container-runtime
66+
ENV NVIDIA_VISIBLE_DEVICES=all
67+
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
68+
69+
# Install CUDA runtime from:
70+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/runtime/Dockerfile
71+
ENV NV_CUDA_LIB_VERSION=12.6.3-1
72+
ENV NV_NVTX_VERSION=12.6.77-1
73+
ENV NV_LIBNPP_VERSION=12.3.1.54-1
74+
ENV NV_LIBNPP_PACKAGE=libnpp-12-6-${NV_LIBNPP_VERSION}
75+
ENV NV_LIBCUBLAS_VERSION=12.6.4.1-1
76+
ENV NV_LIBNCCL_PACKAGE_NAME=libnccl
77+
ENV NV_LIBNCCL_PACKAGE_VERSION=2.23.4-1
78+
ENV NV_LIBNCCL_VERSION=2.23.4
79+
ENV NCCL_VERSION=2.23.4
80+
ENV NV_LIBNCCL_PACKAGE=${NV_LIBNCCL_PACKAGE_NAME}-${NV_LIBNCCL_PACKAGE_VERSION}+cuda12.6
81+
82+
RUN yum install -y \
83+
cuda-libraries-12-6-${NV_CUDA_LIB_VERSION} \
84+
cuda-nvtx-12-6-${NV_NVTX_VERSION} \
85+
${NV_LIBNPP_PACKAGE} \
86+
libcublas-12-6-${NV_LIBCUBLAS_VERSION} \
87+
${NV_LIBNCCL_PACKAGE} \
88+
&& yum clean all \
89+
&& rm -rf /var/cache/yum/*
90+
91+
# Install CUDA devel from:
92+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/devel/Dockerfile
93+
ENV NV_NVPROF_VERSION=12.6.80-1
94+
ENV NV_NVPROF_DEV_PACKAGE=cuda-nvprof-12-6-${NV_NVPROF_VERSION}
95+
ENV NV_CUDA_CUDART_DEV_VERSION=12.6.77-1
96+
ENV NV_NVML_DEV_VERSION=12.6.77-1
97+
ENV NV_LIBCUBLAS_DEV_VERSION=12.6.4.1-1
98+
ENV NV_LIBNPP_DEV_VERSION=12.3.1.54-1
99+
ENV NV_LIBNPP_DEV_PACKAGE=libnpp-devel-12-6-${NV_LIBNPP_DEV_VERSION}
100+
ENV NV_LIBNCCL_DEV_PACKAGE_NAME=libnccl-devel
101+
ENV NV_LIBNCCL_DEV_PACKAGE_VERSION=2.23.4-1
102+
ENV NCCL_VERSION=2.23.4
103+
ENV NV_LIBNCCL_DEV_PACKAGE=${NV_LIBNCCL_DEV_PACKAGE_NAME}-${NV_LIBNCCL_DEV_PACKAGE_VERSION}+cuda12.6
104+
ENV NV_CUDA_NSIGHT_COMPUTE_VERSION=12.6.3-1
105+
ENV NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE=cuda-nsight-compute-12-6-${NV_CUDA_NSIGHT_COMPUTE_VERSION}
106+
107+
RUN yum install -y \
108+
make \
109+
findutils \
110+
cuda-command-line-tools-12-6-${NV_CUDA_LIB_VERSION} \
111+
cuda-libraries-devel-12-6-${NV_CUDA_LIB_VERSION} \
112+
cuda-minimal-build-12-6-${NV_CUDA_LIB_VERSION} \
113+
cuda-cudart-devel-12-6-${NV_CUDA_CUDART_DEV_VERSION} \
114+
${NV_NVPROF_DEV_PACKAGE} \
115+
cuda-nvml-devel-12-6-${NV_NVML_DEV_VERSION} \
116+
libcublas-devel-12-6-${NV_LIBCUBLAS_DEV_VERSION} \
117+
${NV_LIBNPP_DEV_PACKAGE} \
118+
${NV_LIBNCCL_DEV_PACKAGE} \
119+
${NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE} \
120+
&& yum clean all \
121+
&& rm -rf /var/cache/yum/*
122+
123+
ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs
124+
125+
# Install CUDA devel cudnn9 from:
126+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/devel/cudnn/Dockerfile
127+
ENV NV_CUDNN_VERSION=9.5.1.17-1
128+
ENV NV_CUDNN_PACKAGE=libcudnn9-cuda-12-${NV_CUDNN_VERSION}
129+
ENV NV_CUDNN_PACKAGE_DEV=libcudnn9-devel-cuda-12-${NV_CUDNN_VERSION}
130+
131+
LABEL com.nvidia.cudnn.version="${NV_CUDNN_VERSION}"
132+
133+
RUN yum install -y \
134+
${NV_CUDNN_PACKAGE} \
135+
${NV_CUDNN_PACKAGE_DEV} \
136+
&& yum clean all \
137+
&& rm -rf /var/cache/yum/*
138+
139+
# Set this flag so that libraries can find the location of CUDA
140+
ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda
141+
142+
# Restore notebook user workspace
143+
USER 1001
144+
WORKDIR /opt/app-root/src
145+
146+
#########################
147+
# cuda-jupyter-minimal #
148+
#########################
149+
FROM cuda-base AS cuda-jupyter-minimal
150+
151+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
152+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
153+
154+
LABEL name="odh-notebook-jupyter-cuda-minimal-ubi9-python-3.12" \
155+
summary="Minimal Jupyter CUDA notebook image for ODH notebooks" \
156+
description="Minimal Jupyter CUDA notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
157+
io.k8s.display-name="Minimal Jupyter CUDA notebook image for ODH notebooks" \
158+
io.k8s.description="Minimal Jupyter CUDA notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
159+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
160+
io.openshift.build.commit.ref="main" \
161+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/minimal/ubi9-python-3.12" \
162+
io.openshift.build.image="quay.io/opendatahub/workbench-images:cuda-jupyter-minimal-ubi9-python-3.12"
163+
164+
WORKDIR /opt/app-root/bin
165+
166+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
167+
168+
COPY ${MINIMAL_SOURCE_CODE}/Pipfile.lock ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
169+
170+
# Install Python dependencies from Pipfile.lock file
171+
RUN echo "Installing softwares and packages" && \
172+
micropipenv install && \
173+
rm -f ./Pipfile.lock && \
174+
# Disable announcement plugin of jupyterlab \
175+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
176+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
177+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
178+
# Fix permissions to support pip in Openshift environments \
179+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
180+
fix-permissions /opt/app-root -P && \
181+
# Apply JupyterLab addons \
182+
/opt/app-root/bin/utils/addons/apply.sh
183+
184+
WORKDIR /opt/app-root/src
185+
186+
ENTRYPOINT ["start-notebook.sh"]
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
####################
2+
# base #
3+
####################
4+
FROM registry.access.redhat.com/ubi9/python-312:latest AS base
5+
6+
WORKDIR /opt/app-root/bin
7+
8+
# OS Packages needs to be installed as root
9+
USER 0
10+
11+
# Install useful OS packages
12+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
13+
14+
# Other apps and tools installed as default user
15+
USER 1001
16+
17+
# Install micropipenv to deploy packages from Pipfile.lock
18+
RUN pip install --no-cache-dir -U "micropipenv[toml]"
19+
20+
# Install the oc client
21+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
22+
-o /tmp/openshift-client-linux.tar.gz && \
23+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
24+
rm -f /tmp/openshift-client-linux.tar.gz
25+
26+
########################
27+
# rocm-base #
28+
########################
29+
FROM base AS rocm-base
30+
31+
USER 0
32+
WORKDIR /opt/app-root/bin
33+
34+
# Please keep in sync with ROCm/python3.12 dependent images
35+
ARG ROCM_VERSION=6.2.4
36+
ARG AMDGPU_VERSION=6.2.4
37+
38+
# Install the ROCm rpms
39+
# ref: https://github.com/ROCm/ROCm-docker/blob/master/dev/Dockerfile-centos-7-complete
40+
# Note: Based on 6.2 above new package mivisionx is a pre-requistes, which bring in more dependent packages
41+
# so we are only installing meta packages of rocm
42+
# ref: https://rocm.docs.amd.com/projects/install-on-linux/en/develop/reference/package-manager-integration.html#packages-in-rocm-programming-models
43+
RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \
44+
echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \
45+
echo "baseurl=https://repo.radeon.com/rocm/rhel9/$ROCM_VERSION/main" >> /etc/yum.repos.d/rocm.repo && \
46+
echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \
47+
echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo && \
48+
echo "[amdgpu]" > /etc/yum.repos.d/amdgpu.repo && \
49+
echo "name=amdgpu" >> /etc/yum.repos.d/amdgpu.repo && \
50+
echo "baseurl=https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/rhel/9.4/main/x86_64" >> /etc/yum.repos.d/amdgpu.repo && \
51+
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \
52+
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \
53+
yum install -y rocm-developer-tools rocm-ml-sdk rocm-opencl-sdk rocm-openmp-sdk rocm-utils && \
54+
yum clean all && rm -rf /var/cache/yum
55+
56+
# Restore notebook user workspace
57+
USER 1001
58+
WORKDIR /opt/app-root/src
59+
60+
########################
61+
# rocm-jupyter-minimal #
62+
########################
63+
FROM rocm-base AS rocm-jupyter-minimal
64+
65+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
66+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
67+
68+
LABEL name="odh-notebook-jupyter-rocm-minimal-ubi9-python-3.12" \
69+
summary="Minimal Jupyter ROCm notebook image for ODH notebooks" \
70+
description="Minimal Jupyter ROCm notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
71+
io.k8s.display-name="Minimal Jupyter ROCm notebook image for ODH notebooks" \
72+
io.k8s.description="Minimal Jupyter ROCm notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
73+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
74+
io.openshift.build.commit.ref="main" \
75+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/minimal/ubi9-python-3.12" \
76+
io.openshift.build.image="quay.io/opendatahub/workbench-images:rocm-jupyter-minimal-ubi9-python-3.12"
77+
78+
WORKDIR /opt/app-root/bin
79+
80+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
81+
82+
COPY ${MINIMAL_SOURCE_CODE}/Pipfile.lock ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
83+
84+
# Install Python dependencies from Pipfile.lock file
85+
RUN echo "Installing softwares and packages" && \
86+
micropipenv install && \
87+
rm -f ./Pipfile.lock && \
88+
# Disable announcement plugin of jupyterlab \
89+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
90+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
91+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
92+
# Fix permissions to support pip in Openshift environments \
93+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
94+
fix-permissions /opt/app-root -P && \
95+
# Apply JupyterLab addons \
96+
/opt/app-root/bin/utils/addons/apply.sh
97+
98+
WORKDIR /opt/app-root/src
99+
100+
ENTRYPOINT ["start-notebook.sh"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
[[source]]
3+
name = "pypi"
4+
url = "https://pypi.org/simple"
5+
verify_ssl = true
6+
7+
[dev-packages]
8+
9+
[packages]
10+
# JupyterLab packages
11+
jupyterlab = "==4.2.7"
12+
jupyter-server = "~=2.15.0"
13+
jupyter-server-proxy = "~=4.4.0"
14+
jupyter-server-terminals = "~=0.5.3"
15+
jupyterlab-git = "~=0.50.1"
16+
nbdime = "~=4.0.2"
17+
nbgitpuller = "~=1.2.2"
18+
19+
# Base packages
20+
wheel = "~=0.45.1"
21+
setuptools = "~=75.8.2"
22+
23+
[requires]
24+
python_version = "3.12"

0 commit comments

Comments
 (0)