Skip to content

Commit 94f4737

Browse files
committed
creating rocm tensorflow python 3.12 image
1 parent bce04f9 commit 94f4737

File tree

9 files changed

+8321
-4
lines changed

9 files changed

+8321
-4
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ else ifeq ($(PYTHON_VERSION), 3.12)
416416
jupyter/datascience/ubi9-python-$(PYTHON_VERSION) \
417417
jupyter/pytorch/ubi9-python-$(PYTHON_VERSION) \
418418
jupyter/tensorflow/ubi9-python-$(PYTHON_VERSION) \
419-
jupyter/rocm/pytorch/ubi9-python-$(PYTHON_VERSION)
419+
jupyter/rocm/pytorch/ubi9-python-$(PYTHON_VERSION) \
420+
jupyter/rocm/tensorflow/ubi9-python-$(PYTHON_VERSION)
420421
# jupyter/trustyai/ubi9-python-$(PYTHON_VERSION)
421-
# jupyter/rocm/tensorflow/ubi9-python-$(PYTHON_VERSION)
422422
# codeserver/ubi9-python-$(PYTHON_VERSION)
423423
# runtimes/minimal/ubi9-python-$(PYTHON_VERSION)
424424
# runtimes/datascience/ubi9-python-$(PYTHON_VERSION)
@@ -504,7 +504,8 @@ all-images: \
504504
cuda-jupyter-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION) \
505505
cuda-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION) \
506506
cuda-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION) \
507-
rocm-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION)
507+
rocm-jupyter-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION)\
508+
rocm-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
508509
# jupyter-trustyai-ubi9-python-$(RELEASE_PYTHON_VERSION)
509510
# runtime-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION)
510511
# runtime-datascience-ubi9-python-$(RELEASE_PYTHON_VERSION)
@@ -516,7 +517,6 @@ all-images: \
516517
# rstudio-rhel9-python-$(RELEASE_PYTHON_VERSION)
517518
# cuda-rstudio-rhel9-python-$(RELEASE_PYTHON_VERSION)
518519
# rocm-jupyter-minimal-ubi9-python-$(RELEASE_PYTHON_VERSION)
519-
# rocm-jupyter-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
520520
# rocm-runtime-pytorch-ubi9-python-$(RELEASE_PYTHON_VERSION)
521521
# rocm-runtime-tensorflow-ubi9-python-$(RELEASE_PYTHON_VERSION)
522522
else
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
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+
# rocm-base #
41+
########################
42+
FROM base AS rocm-base
43+
44+
USER 0
45+
WORKDIR /opt/app-root/bin
46+
47+
# Please keep in sync with ROCm/python3.12 dependent images
48+
ARG ROCM_VERSION=6.2.4
49+
ARG AMDGPU_VERSION=6.2.4
50+
51+
# Install the ROCm rpms
52+
# ref: https://github.com/ROCm/ROCm-docker/blob/master/dev/Dockerfile-centos-7-complete
53+
# Note: Based on 6.2 above new package mivisionx is a pre-requistes, which bring in more dependent packages
54+
# so we are only installing meta packages of rocm
55+
# ref: https://rocm.docs.amd.com/projects/install-on-linux/en/develop/reference/package-manager-integration.html#packages-in-rocm-programming-models
56+
RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \
57+
echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \
58+
echo "baseurl=https://repo.radeon.com/rocm/rhel9/$ROCM_VERSION/main" >> /etc/yum.repos.d/rocm.repo && \
59+
echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \
60+
echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo && \
61+
echo "[amdgpu]" > /etc/yum.repos.d/amdgpu.repo && \
62+
echo "name=amdgpu" >> /etc/yum.repos.d/amdgpu.repo && \
63+
echo "baseurl=https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/rhel/9.4/main/x86_64" >> /etc/yum.repos.d/amdgpu.repo && \
64+
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \
65+
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \
66+
yum install -y rocm-developer-tools rocm-ml-sdk rocm-opencl-sdk rocm-openmp-sdk rocm-utils && \
67+
yum clean all && rm -rf /var/cache/yum
68+
69+
# Restore notebook user workspace
70+
USER 1001
71+
WORKDIR /opt/app-root/src
72+
73+
########################
74+
# rocm-jupyter-minimal #
75+
########################
76+
FROM rocm-base AS rocm-jupyter-minimal
77+
78+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
79+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
80+
81+
WORKDIR /opt/app-root/bin
82+
83+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
84+
85+
USER 0
86+
87+
# Dependencies for PDF export
88+
RUN ./utils/install_pdf_deps.sh
89+
ENV PATH="/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH"
90+
91+
USER 1001
92+
93+
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
94+
95+
WORKDIR /opt/app-root/src
96+
97+
ENTRYPOINT ["start-notebook.sh"]
98+
99+
############################
100+
# rocm-jupyter-datascience #
101+
############################
102+
FROM rocm-jupyter-minimal AS rocm-jupyter-datascience
103+
104+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
105+
106+
WORKDIR /opt/app-root/bin
107+
108+
# OS Packages needs to be installed as root
109+
USER root
110+
111+
# Install useful OS packages
112+
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
113+
114+
# Copy dynamically-linked mongocli built in earlier build stage
115+
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
116+
117+
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution
118+
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo-x86_64 /etc/yum.repos.d/mssql-2022.repo
119+
120+
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum
121+
122+
ENV PATH="$PATH:/opt/mssql-tools18/bin"
123+
124+
# Other apps and tools installed as default user
125+
USER 1001
126+
127+
# Copy Elyra setup to utils so that it's sourced at startup
128+
COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/
129+
130+
WORKDIR /opt/app-root/src
131+
132+
133+
###########################
134+
# rocm-jupyter-tensorflow #
135+
###########################
136+
FROM rocm-jupyter-datascience AS rocm-jupyter-tensorflow
137+
138+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
139+
ARG TENSORFLOW_SOURCE_CODE=jupyter/rocm/tensorflow/ubi9-python-3.12
140+
141+
WORKDIR /opt/app-root/bin
142+
143+
LABEL name="odh-notebook-jupyter-rocm-tensorflow-ubi9-python-3.12" \
144+
summary="Jupyter AMD tensorflow notebook image for ODH notebooks" \
145+
description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
146+
io.k8s.display-name="Jupyter AMD tensorflow notebook image for ODH notebooks" \
147+
io.k8s.description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
148+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
149+
io.openshift.build.commit.ref="main" \
150+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/rocm/tensorflow/ubi9-python-3.12" \
151+
io.openshift.build.image="quay.io/opendatahub/workbench-images:rocm-jupyter-tensorflow-ubi9-python-3.12"
152+
153+
COPY ${TENSORFLOW_SOURCE_CODE}/Pipfile.lock ./
154+
155+
RUN echo "Installing softwares and packages" && \
156+
micropipenv install --dev && \
157+
rm -f ./Pipfile.lock && \
158+
# setup path for runtime configuration
159+
mkdir /opt/app-root/runtimes && \
160+
# Remove default Elyra runtime-images \
161+
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \
162+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
163+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
164+
# copy jupyter configuration
165+
cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \
166+
# Disable announcement plugin of jupyterlab \
167+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
168+
# Apply JupyterLab addons \
169+
/opt/app-root/bin/utils/addons/apply.sh && \
170+
# Fix permissions to support pip in Openshift environments \
171+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
172+
fix-permissions /opt/app-root -P
173+
174+
WORKDIR /opt/app-root/src
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
# ROCm TensorFlow packages
13+
tensorflow_rocm = "~=2.14.0.600"
14+
tensorboard = "~=2.14.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.17.0"
27+
onnxconverter-common = "~=1.13.0" # Required for skl2onnx, as upgraded version is not compatible with protobuf
28+
codeflare-sdk = "~=0.29.0"
29+
kubeflow-training = "==1.9.0"
30+
31+
# DB connectors
32+
pymongo = "~=4.11.2"
33+
psycopg = "~=3.2.5"
34+
pyodbc = "~=5.2.0"
35+
mysql-connector-python = "~=9.3.0"
36+
37+
# JupyterLab packages
38+
39+
odh-elyra = "==4.2.1"
40+
41+
jupyterlab = "==4.2.7"
42+
jupyter-bokeh = "~=4.0.5"
43+
jupyter-server = "~=2.15.0"
44+
jupyter-server-proxy = "~=4.4.0"
45+
jupyter-server-terminals = "~=0.5.3"
46+
jupyterlab-git = "~=0.50.1"
47+
jupyterlab-lsp = "~=5.1.0"
48+
jupyterlab-widgets = "~=3.0.13"
49+
jupyter-resource-usage = "~=1.1.0"
50+
nbdime = "~=4.0.2"
51+
nbgitpuller = "~=1.2.2"
52+
53+
# Base packages
54+
wheel = "~=0.45.1"
55+
setuptools = "~=78.1.1"
56+
57+
[requires]
58+
python_version = "3.12"

0 commit comments

Comments
 (0)