Skip to content

Commit 6ffbc5f

Browse files
committed
creating jupyter datascience python 3.12 image
1 parent 14c4e5d commit 6ffbc5f

17 files changed

+8010
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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 root
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+
# jupyter-minimal #
41+
####################
42+
FROM base AS jupyter-minimal
43+
44+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
45+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
46+
47+
WORKDIR /opt/app-root/bin
48+
49+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
50+
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
51+
52+
WORKDIR /opt/app-root/src
53+
54+
ENTRYPOINT ["start-notebook.sh"]
55+
56+
57+
########################
58+
# jupytyer-datascience #
59+
########################
60+
FROM jupyter-minimal AS jupyter-datascience
61+
62+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
63+
64+
LABEL name="odh-notebook-jupyter-datascience-ubi9-python-3.12" \
65+
summary="Jupyter data science notebook image for ODH notebooks" \
66+
description="Jupyter data science notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
67+
io.k8s.display-name="Jupyter data science notebook image for ODH notebooks" \
68+
io.k8s.description="Jupyter data science notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
69+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
70+
io.openshift.build.commit.ref="main" \
71+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/datascience/ubi9-python-3.12" \
72+
io.openshift.build.image="quay.io/opendatahub/workbench-images:jupyter-datascience-ubi9-python-3.12"
73+
74+
WORKDIR /opt/app-root/bin
75+
76+
# OS Packages needs to be installed as root
77+
USER root
78+
79+
# Install useful OS packages
80+
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
81+
82+
# Copy dynamically-linked mongocli built in earlier build stage
83+
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
84+
85+
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution
86+
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo-x86_64 /etc/yum.repos.d/mssql-2022.repo
87+
88+
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum
89+
90+
ENV PATH="$PATH:/opt/mssql-tools18/bin"
91+
92+
# Other apps and tools installed as default user
93+
USER 1001
94+
95+
# Install Python packages and Jupyterlab extensions from Pipfile.lock
96+
COPY ${DATASCIENCE_SOURCE_CODE}/Pipfile.lock ./
97+
# Copy Elyra setup to utils so that it's sourced at startup
98+
COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/
99+
100+
RUN echo "Installing softwares and packages" && \
101+
micropipenv install && \
102+
rm -f ./Pipfile.lock && \
103+
# setup path for runtime configuration
104+
mkdir /opt/app-root/runtimes && \
105+
mkdir /opt/app-root/pipeline-runtimes && \
106+
# Remove default Elyra runtime-images \
107+
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \
108+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
109+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
110+
# Disable announcement plugin of jupyterlab \
111+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
112+
# Apply JupyterLab addons \
113+
/opt/app-root/bin/utils/addons/apply.sh && \
114+
# Fix permissions to support pip in Openshift environments \
115+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
116+
fix-permissions /opt/app-root -P
117+
118+
WORKDIR /opt/app-root/src
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[dev-packages]
7+
8+
[packages]
9+
# Datascience and useful extensions
10+
boto3 = "~=1.37.8"
11+
kafka-python-ng = "~=2.2.3"
12+
kfp = "~=2.12.1"
13+
matplotlib = "~=3.10.1"
14+
numpy = "~=2.2.3"
15+
pandas = "~=2.2.3"
16+
plotly = "~=6.0.0"
17+
scikit-learn = "~=1.6.1"
18+
scipy = "~=1.15.2"
19+
skl2onnx = "~=1.18.0"
20+
onnxconverter-common = "~=1.13.0" # Required for skl2onnx, as upgraded version is not compatible with protobuf
21+
codeflare-sdk = "~=0.28.1"
22+
kubeflow-training = "==1.9.2"
23+
24+
# DB connectors
25+
pymongo = "~=4.11.2"
26+
psycopg = "~=3.2.5"
27+
pyodbc = "~=5.2.0"
28+
mysql-connector-python = "~=9.2.0"
29+
30+
# JupyterLab packages
31+
32+
odh-elyra = "==4.2.1"
33+
34+
jupyterlab = "==4.2.7"
35+
jupyter-bokeh = "~=4.0.5"
36+
jupyter-server = "~=2.15.0"
37+
jupyter-server-proxy = "~=4.4.0"
38+
jupyter-server-terminals = "~=0.5.3"
39+
jupyterlab-git = "~=0.50.1"
40+
jupyterlab-lsp = "~=5.1.0"
41+
jupyterlab-widgets = "~=3.0.13"
42+
jupyter-resource-usage = "~=1.1.1"
43+
nbdime = "~=4.0.2"
44+
nbgitpuller = "~=1.2.2"
45+
46+
# Base packages
47+
wheel = "~=0.45.1"
48+
setuptools = "~=75.8.2"
49+
50+
[requires]
51+
python_version = "3.12"

0 commit comments

Comments
 (0)