Skip to content

Commit 410350a

Browse files
committed
add konflux dockerfiles
1 parent 304854c commit 410350a

File tree

2 files changed

+291
-0
lines changed

2 files changed

+291
-0
lines changed
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
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.4
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+
# upgrade first to avoid fixable vulnerabilities begin
25+
RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 --setopt=keepcache=0 \
26+
&& dnf clean all -y
27+
# upgrade first to avoid fixable vulnerabilities end
28+
29+
# Install useful OS packages
30+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
31+
32+
# Other apps and tools installed as default user
33+
USER 1001
34+
35+
# Install micropipenv and uv to deploy packages from requirements.txt begin
36+
RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12"
37+
# Install micropipenv and uv to deploy packages from requirements.txt end
38+
39+
# Install the oc client begin
40+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
41+
-o /tmp/openshift-client-linux.tar.gz && \
42+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
43+
rm -f /tmp/openshift-client-linux.tar.gz
44+
# Install the oc client end
45+
46+
#############
47+
# rocm-base #
48+
#############
49+
FROM base AS rocm-base
50+
51+
USER 0
52+
WORKDIR /opt/app-root/bin
53+
54+
# Please keep in sync with ROCm/python3.12 dependent images
55+
ARG ROCM_VERSION=6.4.3
56+
ARG AMDGPU_VERSION=6.4.3
57+
58+
# Install the ROCm rpms
59+
# ref: https://github.com/ROCm/ROCm-docker/blob/master/dev/Dockerfile-centos-7-complete
60+
# docs: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/install-methods/package-manager/package-manager-rhel.html#registering-rocm-repositories
61+
# Note: Based on 6.4 above new package mivisionx is a pre-requistes, which bring in more dependent packages
62+
# so we are only installing meta packages of rocm
63+
# ref: https://rocm.docs.amd.com/projects/install-on-linux/en/develop/reference/package-manager-integration.html#packages-in-rocm-programming-models
64+
RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \
65+
echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \
66+
echo "baseurl=https://repo.radeon.com/rocm/el9/${ROCM_VERSION}/main" >> /etc/yum.repos.d/rocm.repo && \
67+
echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \
68+
echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo && \
69+
echo "[amdgpu]" > /etc/yum.repos.d/amdgpu.repo && \
70+
echo "name=amdgpu" >> /etc/yum.repos.d/amdgpu.repo && \
71+
echo "baseurl=https://repo.radeon.com/amdgpu/${AMDGPU_VERSION}/rhel/9.4/main/x86_64" >> /etc/yum.repos.d/amdgpu.repo && \
72+
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \
73+
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \
74+
dnf install -y 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' && \
75+
dnf clean all && dnf makecache && \
76+
dnf install -y rocm-developer-tools rocm-ml-sdk rocm-openmp-sdk rocm-utils && \
77+
dnf clean all && rm -rf /var/cache/dnf
78+
79+
# https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/post-install.html#configure-rocm-shared-objects
80+
RUN tee --append /etc/ld.so.conf.d/rocm.conf <<EOF
81+
/opt/rocm/lib
82+
/opt/rocm/lib64
83+
EOF
84+
85+
RUN ldconfig
86+
87+
# Restore notebook user workspace
88+
USER 1001
89+
WORKDIR /opt/app-root/src
90+
91+
########################
92+
# rocm-jupyter-minimal #
93+
########################
94+
FROM rocm-base AS rocm-jupyter-minimal
95+
96+
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
97+
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.12
98+
99+
WORKDIR /opt/app-root/bin
100+
101+
COPY ${JUPYTER_REUSABLE_UTILS} utils/
102+
103+
USER 0
104+
105+
# Dependencies for PDF export begin
106+
RUN ./utils/install_pdf_deps.sh
107+
ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH"
108+
# Dependencies for PDF export end
109+
110+
USER 1001
111+
112+
COPY ${MINIMAL_SOURCE_CODE}/start-notebook.sh ./
113+
114+
WORKDIR /opt/app-root/src
115+
116+
ENTRYPOINT ["start-notebook.sh"]
117+
118+
############################
119+
# rocm-jupyter-datascience #
120+
############################
121+
FROM rocm-jupyter-minimal AS rocm-jupyter-datascience
122+
123+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
124+
125+
WORKDIR /opt/app-root/bin
126+
127+
# OS Packages needs to be installed as root
128+
USER root
129+
130+
# Install useful OS packages
131+
RUN dnf install -y jq unixODBC postgresql git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
132+
133+
# Copy dynamically-linked mongocli built in earlier build stage
134+
COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/
135+
136+
# Install MSSQL Client, We need a special repo for MSSQL as they do their own distribution
137+
COPY ${DATASCIENCE_SOURCE_CODE}/mssql-2022.repo /etc/yum.repos.d/mssql-2022.repo
138+
139+
RUN ACCEPT_EULA=Y dnf install -y mssql-tools18 unixODBC-devel && dnf clean all && rm -rf /var/cache/yum
140+
141+
ENV PATH="$PATH:/opt/mssql-tools18/bin"
142+
143+
# Other apps and tools installed as default user
144+
USER 1001
145+
146+
# Copy Elyra setup to utils so that it's sourced at startup
147+
COPY ${DATASCIENCE_SOURCE_CODE}/setup-elyra.sh ${DATASCIENCE_SOURCE_CODE}/utils ./utils/
148+
149+
WORKDIR /opt/app-root/src
150+
151+
152+
###########################
153+
# rocm-jupyter-tensorflow #
154+
###########################
155+
FROM rocm-jupyter-datascience AS rocm-jupyter-tensorflow
156+
157+
ARG DATASCIENCE_SOURCE_CODE=jupyter/datascience/ubi9-python-3.12
158+
ARG TENSORFLOW_SOURCE_CODE=jupyter/rocm/tensorflow/ubi9-python-3.12
159+
160+
WORKDIR /opt/app-root/bin
161+
162+
COPY ${TENSORFLOW_SOURCE_CODE}/requirements.txt ./
163+
164+
RUN echo "Installing softwares and packages" && \
165+
# This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
166+
# we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
167+
# Not using --build-constraints=./requirements.txt because error: Unnamed requirements are not allowed as constraints (found: `https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/
168+
uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./requirements.txt && \
169+
# setup path for runtime configuration
170+
mkdir /opt/app-root/runtimes && \
171+
# Remove default Elyra runtime-images \
172+
rm /opt/app-root/share/jupyter/metadata/runtime-images/*.json && \
173+
# Replace Notebook's launcher, "(ipykernel)" with Python's version 3.x.y \
174+
sed -i -e "s/Python.*/$(python --version | cut -d '.' -f-2)\",/" /opt/app-root/share/jupyter/kernels/python3/kernel.json && \
175+
# copy jupyter configuration
176+
cp /opt/app-root/bin/utils/jupyter_server_config.py /opt/app-root/etc/jupyter && \
177+
# Disable announcement plugin of jupyterlab \
178+
jupyter labextension disable "@jupyterlab/apputils-extension:announcements" && \
179+
# Apply JupyterLab addons \
180+
/opt/app-root/bin/utils/addons/apply.sh && \
181+
# Fix permissions to support pip in Openshift environments \
182+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
183+
fix-permissions /opt/app-root -P
184+
185+
WORKDIR /opt/app-root/src
186+
187+
LABEL name="rhoai/odh-workbench-jupyter-tensorflow-rocm-py312-rhel9" \
188+
com.redhat.component="odh-workbench-jupyter-tensorflow-rocm-py312-rhel9" \
189+
io.k8s.display-name="odh-workbench-jupyter-tensorflow-rocm-py312-rhel9" \
190+
summary="Jupyter AMD tensorflow notebook image for ODH notebooks" \
191+
description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
192+
io.k8s.description="Jupyter AMD tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
193+
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
# upgrade first to avoid fixable vulnerabilities begin
12+
RUN dnf -y upgrade --refresh --best --nodocs --noplugins --setopt=install_weak_deps=0 --setopt=keepcache=0 \
13+
&& dnf clean all -y
14+
# upgrade first to avoid fixable vulnerabilities end
15+
16+
# Install useful OS packages
17+
RUN dnf install -y mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
18+
19+
# Other apps and tools installed as default user
20+
USER 1001
21+
22+
# Install micropipenv and uv to deploy packages from requirements.txt begin
23+
RUN pip install --no-cache-dir -U "micropipenv[toml]==1.9.0" "uv==0.8.12"
24+
# Install micropipenv and uv to deploy packages from requirements.txt end
25+
26+
# Install the oc client begin
27+
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz \
28+
-o /tmp/openshift-client-linux.tar.gz && \
29+
tar -xzvf /tmp/openshift-client-linux.tar.gz oc && \
30+
rm -f /tmp/openshift-client-linux.tar.gz
31+
# Install the oc client end
32+
33+
#############
34+
# rocm-base #
35+
#############
36+
FROM base AS rocm-base
37+
38+
USER 0
39+
WORKDIR /opt/app-root/bin
40+
41+
# Please keep in sync with ROCm/python3.12 dependent images
42+
ARG ROCM_VERSION=6.2.4
43+
ARG AMDGPU_VERSION=6.2.4
44+
45+
# Install the ROCm rpms
46+
# ref: https://github.com/ROCm/ROCm-docker/blob/master/dev/Dockerfile-centos-7-complete
47+
# Note: Based on 6.2 above new package mivisionx is a pre-requistes, which bring in more dependent packages
48+
# Only the ROCm meta-packages are installed
49+
# ref: https://rocm.docs.amd.com/projects/install-on-linux/en/develop/reference/package-manager-integration.html#packages-in-rocm-programming-models
50+
RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \
51+
echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \
52+
echo "baseurl=https://repo.radeon.com/rocm/rhel9/$ROCM_VERSION/main" >> /etc/yum.repos.d/rocm.repo && \
53+
echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \
54+
echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo && \
55+
echo "[amdgpu]" > /etc/yum.repos.d/amdgpu.repo && \
56+
echo "name=amdgpu" >> /etc/yum.repos.d/amdgpu.repo && \
57+
echo "baseurl=https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/rhel/9.4/main/x86_64" >> /etc/yum.repos.d/amdgpu.repo && \
58+
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \
59+
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \
60+
yum install -y rocm-developer-tools rocm-ml-sdk rocm-opencl-sdk rocm-openmp-sdk rocm-utils && \
61+
yum clean all && rm -rf /var/cache/yum
62+
63+
# Restore notebook user workspace
64+
USER 1001
65+
WORKDIR /opt/app-root/src
66+
67+
###########################
68+
# rocm-runtime-tensorflow #
69+
###########################
70+
FROM rocm-base AS rocm-runtime-tensorflow
71+
72+
ARG TENSORFLOW_SOURCE_CODE=runtimes/rocm-tensorflow/ubi9-python-3.12
73+
74+
WORKDIR /opt/app-root/bin
75+
76+
# Install Python packages from requirements.txt
77+
COPY ${TENSORFLOW_SOURCE_CODE}/requirements.txt ./
78+
# Copy Elyra dependencies for air-gapped enviroment
79+
COPY ${TENSORFLOW_SOURCE_CODE}/utils ./utils/
80+
81+
RUN echo "Installing softwares and packages" && \
82+
# This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
83+
# we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
84+
# Not using --build-constraints=./requirements.txt because error: Unnamed requirements are not allowed as constraints (found: `https://repo.radeon.com/rocm/manylinux/rocm-rel-6.4/
85+
uv pip install --strict --no-deps --no-cache --no-config --no-progress --verify-hashes --compile-bytecode --index-strategy=unsafe-best-match --requirements=./requirements.txt && \
86+
# Fix permissions to support pip in Openshift environments \
87+
chmod -R g+w /opt/app-root/lib/python3.12/site-packages && \
88+
fix-permissions /opt/app-root -P
89+
90+
WORKDIR /opt/app-root/src
91+
92+
LABEL name="rhoai/odh-pipeline-runtime-tensorflow-rocm-py312-rhel9" \
93+
com.redhat.component="odh-pipeline-runtime-tensorflow-rocm-py312-rhel9" \
94+
io.k8s.display-name="odh-pipeline-runtime-tensorflow-rocm-py312-rhel9" \
95+
summary="Runtime ROCm tensorflow notebook image for ODH notebooks" \
96+
description="Runtime ROCm tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
97+
io.k8s.description="Runtime ROCm tensorflow notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
98+
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"

0 commit comments

Comments
 (0)