Skip to content

Commit c8fae8a

Browse files
committed
backport changes from pr:1318 to main
Signed-off-by: Md. Shafi Hussain <[email protected]>
1 parent e8eb7ff commit c8fae8a

File tree

4 files changed

+216
-19
lines changed

4 files changed

+216
-19
lines changed

jupyter/minimal/ubi9-python-3.11/Dockerfile.konflux.cpu

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
############################
2+
# Stage 1: PDF Tool Build #
3+
############################
4+
FROM registry.access.redhat.com/ubi9/python-311:latest AS pdf-builder
5+
6+
WORKDIR /opt/app-root/bin
7+
8+
# OS Packages needs to be installed as root
9+
USER 0
10+
11+
# Copy scripts
12+
COPY jupyter/utils/install_texlive.sh ./install_texlive.sh
13+
COPY jupyter/utils/install_pandoc.sh ./install_pandoc.sh
14+
RUN chmod +x install_texlive.sh install_pandoc.sh
15+
16+
RUN ./install_texlive.sh
17+
RUN ./install_pandoc.sh
18+
119
####################
220
# base #
321
####################
@@ -38,14 +56,26 @@ FROM base AS jupyter-minimal
3856
ARG JUPYTER_REUSABLE_UTILS=jupyter/utils
3957
ARG MINIMAL_SOURCE_CODE=jupyter/minimal/ubi9-python-3.11
4058

59+
LABEL name="odh-notebook-jupyter-minimal-ubi9-python-3.11" \
60+
summary="Minimal Jupyter notebook image for ODH notebooks" \
61+
description="Minimal Jupyter notebook image with base Python 3.11 builder image based on UBI9 for ODH notebooks" \
62+
io.k8s.display-name="Minimal Jupyter notebook image for ODH notebooks" \
63+
io.k8s.description="Minimal Jupyter notebook image with base Python 3.11 builder image based on UBI9 for ODH notebooks" \
64+
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
65+
io.openshift.build.commit.ref="main" \
66+
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/jupyter/minimal/ubi9-python-3.11" \
67+
io.openshift.build.image="quay.io/opendatahub/workbench-images:jupyter-minimal-ubi9-python-3.11"
68+
4169
WORKDIR /opt/app-root/bin
4270

4371
COPY ${JUPYTER_REUSABLE_UTILS} utils/
4472

4573
USER 0
4674

47-
# Dependencies for PDF export begin
48-
RUN ./utils/install_pdf_deps.sh
75+
# Copy built TeXLive and Pandoc binaries only (no build deps)
76+
COPY --from=pdf-builder /usr/local/texlive /usr/local/texlive
77+
COPY --from=pdf-builder /usr/local/pandoc /usr/local/pandoc
78+
4979
ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH"
5080
# Dependencies for PDF export end
5181

@@ -73,10 +103,3 @@ WORKDIR /opt/app-root/src
73103

74104
ENTRYPOINT ["start-notebook.sh"]
75105

76-
LABEL name="rhoai/odh-workbench-jupyter-minimal-cpu-py311-rhel9" \
77-
com.redhat.component="odh-workbench-jupyter-minimal-cpu-py311-rhel9" \
78-
io.k8s.display-name="odh-workbench-jupyter-minimal-cpu-py311-rhel9" \
79-
summary="Minimal Jupyter notebook image for ODH notebooks" \
80-
description="Minimal Jupyter notebook image with base Python 3.11 builder image based on UBI9 for ODH notebooks" \
81-
io.k8s.description="Minimal Jupyter notebook image with base Python 3.11 builder image based on UBI9 for ODH notebooks" \
82-
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"

jupyter/minimal/ubi9-python-3.12/Dockerfile.konflux.cpu

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
############################
2+
# Stage 1: PDF Tool Build #
3+
############################
4+
FROM registry.access.redhat.com/ubi9/python-312:latest AS pdf-builder
5+
6+
WORKDIR /opt/app-root/bin
7+
8+
# OS Packages needs to be installed as root
9+
USER 0
10+
11+
# Copy scripts
12+
COPY jupyter/utils/install_texlive.sh ./install_texlive.sh
13+
COPY jupyter/utils/install_pandoc.sh ./install_pandoc.sh
14+
RUN chmod +x install_texlive.sh install_pandoc.sh
15+
16+
RUN ./install_texlive.sh
17+
RUN ./install_pandoc.sh
18+
119
####################
220
# base #
321
####################
@@ -54,8 +72,10 @@ COPY ${JUPYTER_REUSABLE_UTILS} utils/
5472

5573
USER 0
5674

57-
# Dependencies for PDF export begin
58-
RUN ./utils/install_pdf_deps.sh
75+
# Copy built TeXLive and Pandoc binaries only (no build deps)
76+
COPY --from=pdf-builder /usr/local/texlive /usr/local/texlive
77+
COPY --from=pdf-builder /usr/local/pandoc /usr/local/pandoc
78+
5979
ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH"
6080
# Dependencies for PDF export end
6181

@@ -80,11 +100,3 @@ RUN echo "Installing softwares and packages" && \
80100
WORKDIR /opt/app-root/src
81101

82102
ENTRYPOINT ["start-notebook.sh"]
83-
84-
LABEL name="rhoai/odh-workbench-jupyter-minimal-cpu-py312-rhel9" \
85-
com.redhat.component="odh-workbench-jupyter-minimal-cpu-py312-rhel9" \
86-
io.k8s.display-name="odh-workbench-jupyter-minimal-cpu-py312-rhel9" \
87-
summary="Minimal Jupyter notebook image for ODH notebooks" \
88-
description="Minimal Jupyter notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
89-
io.k8s.description="Minimal Jupyter notebook image with base Python 3.12 builder image based on UBI9 for ODH notebooks" \
90-
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf"

jupyter/utils/install_pandoc.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
# Mapping of `uname -m` values to equivalent GOARCH values
5+
declare -A UNAME_TO_GOARCH
6+
UNAME_TO_GOARCH["x86_64"]="amd64"
7+
UNAME_TO_GOARCH["aarch64"]="arm64"
8+
UNAME_TO_GOARCH["ppc64le"]="ppc64le"
9+
UNAME_TO_GOARCH["s390x"]="s390x"
10+
11+
ARCH="${UNAME_TO_GOARCH[$(uname -m)]}"
12+
13+
if [[ "$ARCH" == "ppc64le" ]]; then
14+
# Install Pandoc from source
15+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
16+
dnf install -y cabal-install ghc gmp-devel
17+
18+
# Set version
19+
PANDOC_VERSION=3.7.0.2
20+
21+
cd /tmp
22+
git clone --recurse-submodules https://github.com/jgm/pandoc.git
23+
cd pandoc
24+
git checkout ${PANDOC_VERSION}
25+
git submodule update --init --recursive
26+
27+
export HOME=/root
28+
# Initialize cabal user config (don't fail if already done)
29+
cabal user-config init || true
30+
31+
# Modify config
32+
echo "repository hackage.haskell.org
33+
url: https://hackage.haskell.org/
34+
secure: False" >> $HOME/.cabal/config
35+
36+
cabal update
37+
cd pandoc-cli
38+
cabal build -j"$(nproc)"
39+
mkdir -p /usr/local/pandoc/bin
40+
cabal install \
41+
--installdir=/usr/local/pandoc/bin \
42+
--overwrite-policy=always \
43+
--install-method=copy
44+
45+
# Clean up Haskell build system
46+
rm -rf ~/.cabal ~/.ghc /tmp/pandoc
47+
dnf remove -y cabal-install ghc gmp-devel
48+
dnf clean all && rm -rf /var/cache/dnf
49+
50+
/usr/local/pandoc/bin/pandoc --version
51+
52+
elif [[ "$ARCH" == "amd64" ]]; then
53+
# pandoc installation
54+
curl -fL "https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-${ARCH}.tar.gz" -o /tmp/pandoc.tar.gz
55+
mkdir -p /usr/local/pandoc
56+
tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/
57+
rm -f /tmp/pandoc.tar.gz
58+
59+
else
60+
echo "Unsupported architecture: $ARCH" >&2
61+
exit 1
62+
fi

jupyter/utils/install_texlive.sh

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
# Mapping of `uname -m` values to equivalent GOARCH values
5+
declare -A UNAME_TO_GOARCH
6+
UNAME_TO_GOARCH["x86_64"]="amd64"
7+
UNAME_TO_GOARCH["aarch64"]="arm64"
8+
UNAME_TO_GOARCH["ppc64le"]="ppc64le"
9+
UNAME_TO_GOARCH["s390x"]="s390x"
10+
11+
ARCH="${UNAME_TO_GOARCH[$(uname -m)]}"
12+
13+
if [[ "$ARCH" == "ppc64le" ]]; then
14+
echo "Installing TeX Live from source for $ARCH..."
15+
16+
# Install build dependencies
17+
dnf install -y gcc-toolset-13 perl make libX11-devel \
18+
zlib-devel freetype-devel libpng-devel ncurses-devel \
19+
gd-devel libtool wget tar xz
20+
21+
rpm -q libXmu-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXmu-devel-1.1.3-8.el9.ppc64le.rpm
22+
rpm -q libXext-devel|| rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXext-devel-1.3.4-8.el9.ppc64le.rpm
23+
rpm -q libICE-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libICE-devel-1.0.10-8.el9.ppc64le.rpm
24+
rpm -q libSM-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libSM-devel-1.2.3-10.el9.ppc64le.rpm
25+
rpm -q libXmu || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXmu-1.1.3-8.el9.ppc64le.rpm
26+
rpm -q libXaw-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXaw-devel-1.0.13-19.el9.ppc64le.rpm
27+
rpm -q libXaw || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXaw-1.0.13-19.el9.ppc64le.rpm
28+
rpm -q libXt-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXt-devel-1.2.0-6.el9.ppc64le.rpm
29+
rpm -q flex || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/flex-2.6.4-9.el9.ppc64le.rpm
30+
rpm -q bison || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/bison-3.7.4-5.el9.ppc64le.rpm
31+
32+
# Step 1: Download and extract the TeX Live source
33+
wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz
34+
tar -xf texlive-20250308-source.tar.xz
35+
cd texlive-20250308-source
36+
37+
# Enable newer GCC toolchain
38+
source /opt/rh/gcc-toolset-13/enable
39+
40+
# Create build directory and build
41+
mkdir -p ../texlive-build
42+
cd ../texlive-build
43+
../texlive-20250308-source/configure --prefix=/usr/local/texlive
44+
make -j"$(nproc)"
45+
make install
46+
47+
# Symlink for pdflatex
48+
ln -sf pdftex /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu/pdflatex
49+
50+
# Cleanup sources to reduce image size
51+
rm -rf /texlive-20250308-source /texlive-build
52+
53+
# Step 2: Run TeX Live installer for runtime tree setup
54+
cd /
55+
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
56+
tar -xzf install-tl-unx.tar.gz
57+
cd install-tl-2*/
58+
59+
# Create a custom install profile
60+
TEXLIVE_INSTALL_PREFIX="/usr/local/texlive"
61+
cat <<EOF > texlive.profile
62+
selected_scheme scheme-small
63+
TEXDIR $TEXLIVE_INSTALL_PREFIX
64+
TEXMFCONFIG ~/.texlive2025/texmf-config
65+
TEXMFVAR ~/.texlive2025/texmf-var
66+
option_doc 0
67+
option_src 0
68+
EOF
69+
70+
./install-tl --profile=texlive.profile --custom-bin=$TEXLIVE_INSTALL_PREFIX/bin/powerpc64le-unknown-linux-gnu
71+
72+
# TeX Live binary directory
73+
TEX_BIN_DIR="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu"
74+
75+
# Create standard symlink 'linux' → arch-specific folder
76+
ln -sf "$TEX_BIN_DIR" /usr/local/texlive/bin/linux
77+
78+
79+
# Set up environment
80+
export PATH="$TEXLIVE_INSTALL_PREFIX/bin/linux:$PATH"
81+
pdflatex --version
82+
tlmgr --version
83+
84+
elif [[ "$ARCH" == "amd64" ]]; then
85+
# tex live installation
86+
echo "Installing TexLive to allow PDf export from Notebooks"
87+
curl -fL https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz
88+
zcat < install-tl-unx.tar.gz | tar xf -
89+
cd install-tl-2*
90+
perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive
91+
mv /usr/local/texlive/bin/"$(uname -m)-linux" /usr/local/texlive/bin/linux
92+
cd /usr/local/texlive/bin/linux
93+
./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended
94+
95+
else
96+
echo "Unsupported architecture: $ARCH" >&2
97+
exit 1
98+
99+
fi
100+

0 commit comments

Comments
 (0)