Skip to content

Commit 00f02cb

Browse files
committed
creating jupyter tensorflow python 3.12 image
1 parent 8f1bda8 commit 00f02cb

File tree

8 files changed

+8703
-0
lines changed

8 files changed

+8703
-0
lines changed
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
######################################################
2+
# mongocli-builder (build stage only, not published) #
3+
######################################################
4+
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS mongocli-builder
5+
6+
ARG MONGOCLI_VERSION=2.0.3
7+
8+
WORKDIR /tmp/
9+
RUN curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mongodb/mongodb-cli/archive/refs/tags/mongocli/v${MONGOCLI_VERSION}.zip
10+
RUN unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip
11+
RUN cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ && \
12+
CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/
13+
14+
####################
15+
# base #
16+
####################
17+
FROM registry.access.redhat.com/ubi9/python-312:latest AS base
18+
19+
WORKDIR /opt/app-root/bin
20+
21+
# OS Packages needs to be installed as root
22+
USER 0
23+
24+
# Install useful OS packages
25+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
26+
27+
# Other apps and tools installed as default user
28+
USER 1001
29+
30+
# Install micropipenv to deploy packages from Pipfile.lock
31+
RUN pip install --no-cache-dir -U "micropipenv[toml]"
32+
33+
# Install the oc client
34+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
35+
-o /tmp/openshift-client-linux.tar.gz && \
36+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
37+
rm -f /tmp/openshift-client-linux.tar.gz
38+
39+
####################
40+
# cuda-base #
41+
####################
42+
FROM base AS cuda-base
43+
44+
ARG CUDA_SOURCE_CODE=cuda
45+
46+
# Install CUDA base from:
47+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/base/Dockerfile
48+
USER 0
49+
WORKDIR /opt/app-root/bin
50+
51+
ENV NVARCH=x86_64
52+
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"
53+
ENV NV_CUDA_CUDART_VERSION=12.6.77-1
54+
55+
COPY ${CUDA_SOURCE_CODE}/cuda.repo-x86_64 /etc/yum.repos.d/cuda.repo
56+
COPY ${CUDA_SOURCE_CODE}/NGC-DL-CONTAINER-LICENSE /
57+
58+
RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
59+
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 && \
60+
echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
61+
62+
ENV CUDA_VERSION=12.6.3
63+
64+
# For libraries in the cuda-compat-* package: https://docs.nvidia.com/cuda/eula/index.html#attachment-a
65+
RUN yum upgrade -y && yum install -y \
66+
cuda-cudart-12-6-${NV_CUDA_CUDART_VERSION} \
67+
cuda-compat-12-6 \
68+
&& yum clean all \
69+
&& rm -rf /var/cache/yum/*
70+
71+
# nvidia-docker 1.0
72+
RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \
73+
echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf
74+
75+
ENV PATH=/usr/local/nvidia/bin:/usr/local/cuda/bin:${PATH}
76+
ENV LD_LIBRARY_PATH=/usr/local/nvidia/lib:/usr/local/nvidia/lib64
77+
78+
# nvidia-container-runtime
79+
ENV NVIDIA_VISIBLE_DEVICES=all
80+
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
81+
82+
# Install CUDA runtime from:
83+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/runtime/Dockerfile
84+
ENV NV_CUDA_LIB_VERSION=12.6.3-1
85+
ENV NV_NVTX_VERSION=12.6.77-1
86+
ENV NV_LIBNPP_VERSION=12.3.1.54-1
87+
ENV NV_LIBNPP_PACKAGE=libnpp-12-6-${NV_LIBNPP_VERSION}
88+
ENV NV_LIBCUBLAS_VERSION=12.6.4.1-1
89+
ENV NV_LIBNCCL_PACKAGE_NAME=libnccl
90+
ENV NV_LIBNCCL_PACKAGE_VERSION=2.23.4-1
91+
ENV NV_LIBNCCL_VERSION=2.23.4
92+
ENV NCCL_VERSION=2.23.4
93+
ENV NV_LIBNCCL_PACKAGE=${NV_LIBNCCL_PACKAGE_NAME}-${NV_LIBNCCL_PACKAGE_VERSION}+cuda12.6
94+
95+
RUN yum install -y \
96+
cuda-libraries-12-6-${NV_CUDA_LIB_VERSION} \
97+
cuda-nvtx-12-6-${NV_NVTX_VERSION} \
98+
${NV_LIBNPP_PACKAGE} \
99+
libcublas-12-6-${NV_LIBCUBLAS_VERSION} \
100+
${NV_LIBNCCL_PACKAGE} \
101+
&& yum clean all \
102+
&& rm -rf /var/cache/yum/*
103+
104+
# Install CUDA devel from:
105+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/devel/Dockerfile
106+
ENV NV_NVPROF_VERSION=12.6.80-1
107+
ENV NV_NVPROF_DEV_PACKAGE=cuda-nvprof-12-6-${NV_NVPROF_VERSION}
108+
ENV NV_CUDA_CUDART_DEV_VERSION=12.6.77-1
109+
ENV NV_NVML_DEV_VERSION=12.6.77-1
110+
ENV NV_LIBCUBLAS_DEV_VERSION=12.6.4.1-1
111+
ENV NV_LIBNPP_DEV_VERSION=12.3.1.54-1
112+
ENV NV_LIBNPP_DEV_PACKAGE=libnpp-devel-12-6-${NV_LIBNPP_DEV_VERSION}
113+
ENV NV_LIBNCCL_DEV_PACKAGE_NAME=libnccl-devel
114+
ENV NV_LIBNCCL_DEV_PACKAGE_VERSION=2.23.4-1
115+
ENV NCCL_VERSION=2.23.4
116+
ENV NV_LIBNCCL_DEV_PACKAGE=${NV_LIBNCCL_DEV_PACKAGE_NAME}-${NV_LIBNCCL_DEV_PACKAGE_VERSION}+cuda12.6
117+
ENV NV_CUDA_NSIGHT_COMPUTE_VERSION=12.6.3-1
118+
ENV NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE=cuda-nsight-compute-12-6-${NV_CUDA_NSIGHT_COMPUTE_VERSION}
119+
120+
RUN yum install -y \
121+
make \
122+
findutils \
123+
cuda-command-line-tools-12-6-${NV_CUDA_LIB_VERSION} \
124+
cuda-libraries-devel-12-6-${NV_CUDA_LIB_VERSION} \
125+
cuda-minimal-build-12-6-${NV_CUDA_LIB_VERSION} \
126+
cuda-cudart-devel-12-6-${NV_CUDA_CUDART_DEV_VERSION} \
127+
${NV_NVPROF_DEV_PACKAGE} \
128+
cuda-nvml-devel-12-6-${NV_NVML_DEV_VERSION} \
129+
libcublas-devel-12-6-${NV_LIBCUBLAS_DEV_VERSION} \
130+
${NV_LIBNPP_DEV_PACKAGE} \
131+
${NV_LIBNCCL_DEV_PACKAGE} \
132+
${NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE} \
133+
&& yum clean all \
134+
&& rm -rf /var/cache/yum/*
135+
136+
ENV LIBRARY_PATH=/usr/local/cuda/lib64/stubs
137+
138+
# Install CUDA devel cudnn9 from:
139+
# https://gitlab.com/nvidia/container-images/cuda/-/blob/master/dist/12.6.3/ubi9/devel/cudnn/Dockerfile
140+
ENV NV_CUDNN_VERSION=9.5.1.17-1
141+
ENV NV_CUDNN_PACKAGE=libcudnn9-cuda-12-${NV_CUDNN_VERSION}
142+
ENV NV_CUDNN_PACKAGE_DEV=libcudnn9-devel-cuda-12-${NV_CUDNN_VERSION}
143+
144+
LABEL com.nvidia.cudnn.version="${NV_CUDNN_VERSION}"
145+
146+
RUN yum install -y \
147+
${NV_CUDNN_PACKAGE} \
148+
${NV_CUDNN_PACKAGE_DEV} \
149+
&& yum clean all \
150+
&& rm -rf /var/cache/yum/*
151+
152+
# Set this flag so that libraries can find the location of CUDA
153+
ENV XLA_FLAGS=--xla_gpu_cuda_data_dir=/usr/local/cuda
154+
155+
# Restore notebook user workspace
156+
USER 1001
157+
WORKDIR /opt/app-root/src
158+
159+
#########################
160+
# cuda-jupyter-minimal #
161+
#########################
162+
FROM cuda-base AS cuda-jupyter-minimal
163+
164+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
165+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
166+
167+
WORKDIR /opt/app-root/bin
168+
169+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
170+
171+
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
172+
173+
WORKDIR /opt/app-root/src
174+
175+
ENTRYPOINT ["start-notebook.sh"]
176+
177+
#############################
178+
# cuda-jupyter-datascience #
179+
#############################
180+
FROM cuda-jupyter-minimal AS cuda-jupyter-datascience
181+
182+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
183+
184+
WORKDIR /opt/app-root/bin
185+
186+
# OS Packages needs to be installed as root
187+
USER root
188+
189+
# Install useful OS packages
190+
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
191+
192+
# Copy dynamically-linked mongocli built in earlier build stage
193+
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
194+
195+
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution
196+
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo-x86_64 /etc/yum.repos.d/mssql-2022.repo
197+
198+
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum
199+
200+
ENV PATH="$PATH:/opt/mssql-tools18/bin"
201+
202+
# Other apps and tools installed as default user
203+
USER 1001
204+
205+
# Copy Elyra setup to utils so that it's sourced at startup
206+
COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/
207+
208+
WORKDIR /opt/app-root/src
209+
210+
############################
211+
# cuda-jupyter-tensorflow #
212+
############################
213+
FROM cuda-jupyter-datascience AS cuda-jupyter-tensorflow
214+
215+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
216+
ARG TENSORFLOW_SOURCE_CODE=jupyter/tensorflow/ubi9-python-3.12
217+
218+
WORKDIR /opt/app-root/bin
219+
220+
LABEL name="odh-notebook-cuda-jupyter-tensorflow-ubi9-python-3.12" \
221+
summary="Jupyter CUDA tensorflow notebook image for ODH notebooks" \
222+
description="Jupyter CUDA tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
223+
io.k8s.display-name="Jupyter CUDA tensorflow notebook image for ODH notebooks" \
224+
io.k8s.description="Jupyter CUDA tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
225+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
226+
io.openshift.build.commit.ref="main" \
227+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/tensorflow/ubi9-python-3.12" \
228+
io.openshift.build.image="quay.io/opendatahub/workbench-images:cuda-jupyter-tensorflow-ubi9-python-3.12"
229+
230+
# Install Python packages and Jupyterlab extensions from Pipfile.lock
231+
COPY ${TENSORFLOW_SOURCE_CODE}/Pipfile.lock ./
232+
233+
RUN echo "Installing softwares and packages" && \
234+
micropipenv install --dev && \
235+
rm -f ./Pipfile.lock && \
236+
# setup path for runtime configuration
237+
mkdir /opt/app-root/runtimes && \
238+
# Remove default Elyra runtime-images \
239+
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \
240+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
241+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
242+
# Disable announcement plugin of jupyterlab \
243+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
244+
# Apply JupyterLab addons \
245+
/opt/app-root/bin/utils/addons/apply.sh && \
246+
# Fix permissions to support pip in Openshift environments \
247+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
248+
fix-permissions /opt/app-root -P
249+
250+
WORKDIR /opt/app-root/src
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[dev-packages]
7+
# tf2onnx has pinned protobuf version, that causes conflict with other packages
8+
# This is a workaround to avoid the conflict
9+
tf2onnx = "~=1.16.1"
10+
11+
[packages]
12+
# TensorFlow packages
13+
tensorflow = {version = "~=2.18.0", extras = ["and-cuda"]}
14+
tensorboard = "~=2.18.0"
15+
16+
# Datascience and useful extensions
17+
boto3 = "~=1.37.8"
18+
kafka-python-ng = "~=2.2.3"
19+
kfp = "~=2.12.1"
20+
matplotlib = "~=3.10.1"
21+
numpy = "~=1.26.4"
22+
pandas = "~=2.2.3"
23+
plotly = "~=6.0.0"
24+
scikit-learn = "~=1.6.1"
25+
scipy = "~=1.15.2"
26+
skl2onnx = "~=1.18.0"
27+
onnxconverter-common = "~=1.13.0" # Required for skl2onnx, as upgraded version is not compatible with protobuf
28+
codeflare-sdk = "~=0.28.1"
29+
30+
# DB connectors
31+
pymongo = "~=4.11.2"
32+
psycopg = "~=3.2.5"
33+
pyodbc = "~=5.2.0"
34+
mysql-connector-python = "~=9.2.0"
35+
36+
# JupyterLab packages
37+
odh-elyra = "==4.2.1"
38+
39+
jupyterlab = "==4.2.7"
40+
jupyter-bokeh = "~=4.0.5"
41+
jupyter-server = "~=2.15.0"
42+
jupyter-server-proxy = "~=4.4.0"
43+
jupyter-server-terminals = "~=0.5.3"
44+
jupyterlab-git = "~=0.50.1"
45+
jupyterlab-lsp = "~=5.1.0"
46+
jupyterlab-widgets = "~=3.0.13"
47+
jupyter-resource-usage = "~=1.1.1"
48+
nbdime = "~=4.0.2"
49+
nbgitpuller = "~=1.2.2"
50+
51+
# Base packages
52+
wheel = "~=0.45.1"
53+
setuptools = "~=75.8.2"
54+
55+
[requires]
56+
python_version = "3.12"

0 commit comments

Comments
 (0)