From 9211d5193d8d7fc0a356c266270da87f8a8eb561 Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Mon, 23 Jun 2025 06:20:59 -0400 Subject: [PATCH 01/11] Add TeX Live install for ppc64le --- jupyter/utils/install_pdf_deps.sh | 53 ++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/jupyter/utils/install_pdf_deps.sh b/jupyter/utils/install_pdf_deps.sh index 513c45f6d..c647e4a0f 100755 --- a/jupyter/utils/install_pdf_deps.sh +++ b/jupyter/utils/install_pdf_deps.sh @@ -1,20 +1,51 @@ -#!/bin/bash +#!/bin/bash # Install dependencies required for Notebooks PDF exports set -euxo -# tex live installation -echo "Installing TexLive to allow PDf export from Notebooks" -curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz -zcat < install-tl-unx.tar.gz | tar xf - -cd install-tl-2* -perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive -cd /usr/local/texlive/bin/x86_64-linux -./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended +ARCH=$(uname -m) + +if [[ "$ARCH" == "ppc64le" ]]; then + echo "Installing TeX Live from source for $ARCH" + + # Download and extract source + wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz + tar -xf texlive-20250308-source.tar.xz + cd texlive-20250308-source + + # Install build dependencies + dnf install -y gcc gcc-c++ perl make libX11-devel libXt-devel \ + zlib-devel freetype-devel libpng-devel ncurses-devel \ + gd-devel libtool wget tar xz bison flex libXaw-devel + + # Create build directory + mkdir ../texlive-build + cd ../texlive-build + + # Configure, build, install + ../texlive-20250308-source/configure --prefix=/opt/texlive/2025 + make -j$(nproc) + make install + + # Symlink for pdflatex + cd /opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu + ln -s pdftex pdflatex + +else + echo "Installing TeX Live from installer for $ARCH" + + # Download and install from official installer + curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz + zcat < install-tl-unx.tar.gz | tar xf - + cd install-tl-2* + perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive + cd /usr/local/texlive/bin/x86_64-linux + ./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended +fi # pandoc installation -curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz +curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz mkdir -p /usr/local/pandoc tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ -rm -f /tmp/pandoc.tar.gz \ No newline at end of file +rm -f /tmp/pandoc.tar.gz From 38b91c3414cbd77bed35cc5eb684bc5f56ed67a2 Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Mon, 23 Jun 2025 13:49:02 -0400 Subject: [PATCH 02/11] Installing pandoc on power --- jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu | 3 ++- jupyter/utils/install_pdf_deps.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu index f148c0a09..d4d28b8a2 100644 --- a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu @@ -50,6 +50,7 @@ USER 0 # Dependencies for PDF export RUN ./utils/install_pdf_deps.sh ENV PATH="/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH" +ENV PATH="/opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu:$PATH" USER 1001 @@ -73,4 +74,4 @@ RUN echo "Installing softwares and packages" && \ WORKDIR /opt/app-root/src -ENTRYPOINT ["start-notebook.sh"] \ No newline at end of file +ENTRYPOINT ["start-notebook.sh"] diff --git a/jupyter/utils/install_pdf_deps.sh b/jupyter/utils/install_pdf_deps.sh index c647e4a0f..f23f193d3 100755 --- a/jupyter/utils/install_pdf_deps.sh +++ b/jupyter/utils/install_pdf_deps.sh @@ -31,6 +31,12 @@ if [[ "$ARCH" == "ppc64le" ]]; then # Symlink for pdflatex cd /opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu ln -s pdftex pdflatex + export PATH="/opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu:$PATH" + pdflatex --version + + # Install pandoc + dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + dnf install -y pandoc else echo "Installing TeX Live from installer for $ARCH" From 7184ab0b7ccacaf602e4dc27bd1770830f4b28cf Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Tue, 24 Jun 2025 00:32:23 -0400 Subject: [PATCH 03/11] Update PATH to support TeX Live for both ppc64le and x86_64 --- jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu index d4d28b8a2..705c7b0cb 100644 --- a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu @@ -49,8 +49,7 @@ USER 0 # Dependencies for PDF export RUN ./utils/install_pdf_deps.sh -ENV PATH="/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH" -ENV PATH="/opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu:$PATH" +ENV PATH="/opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH" USER 1001 From c5eb49ae7a5f780b77d9fe9e8901264fa4687678 Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Fri, 27 Jun 2025 01:21:57 -0400 Subject: [PATCH 04/11] Improve TeX Live and Pandoc setup --- .../minimal/ubi9-python-3.11/Dockerfile.cpu | 2 +- jupyter/utils/install_pdf_deps.sh | 66 ++++++++++++++----- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu index 705c7b0cb..b46fd3be3 100644 --- a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu @@ -49,7 +49,7 @@ USER 0 # Dependencies for PDF export RUN ./utils/install_pdf_deps.sh -ENV PATH="/opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH" +ENV PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/x86_64-linux:/usr/local/pandoc/bin:$PATH" USER 1001 diff --git a/jupyter/utils/install_pdf_deps.sh b/jupyter/utils/install_pdf_deps.sh index f23f193d3..d01bb0f77 100755 --- a/jupyter/utils/install_pdf_deps.sh +++ b/jupyter/utils/install_pdf_deps.sh @@ -2,7 +2,8 @@ # Install dependencies required for Notebooks PDF exports -set -euxo +set -euo pipefail +set -x ARCH=$(uname -m) @@ -15,43 +16,74 @@ if [[ "$ARCH" == "ppc64le" ]]; then cd texlive-20250308-source # Install build dependencies - dnf install -y gcc gcc-c++ perl make libX11-devel libXt-devel \ + dnf install -y gcc-toolset-13 perl make libX11-devel libXt-devel \ zlib-devel freetype-devel libpng-devel ncurses-devel \ gd-devel libtool wget tar xz bison flex libXaw-devel + source /opt/rh/gcc-toolset-13/enable + # Create build directory mkdir ../texlive-build cd ../texlive-build # Configure, build, install - ../texlive-20250308-source/configure --prefix=/opt/texlive/2025 + ../texlive-20250308-source/configure --prefix=/usr/local/texlive make -j$(nproc) make install # Symlink for pdflatex - cd /opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu + cd /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu ln -s pdftex pdflatex - export PATH="/opt/texlive/2025/bin/powerpc64le-unknown-linux-gnu:$PATH" + export PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:$PATH" pdflatex --version - # Install pandoc + # Install dependencies dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm - dnf install -y pandoc + dnf install -y cabal-install ghc gmp-devel + # Set version + PANDOC_VERSION=3.7.0.2 + + # Clone repo + cd /tmp + git clone --recurse-submodules https://github.com/jgm/pandoc.git + cd pandoc + git checkout ${PANDOC_VERSION} + git submodule update --init --recursive + + # Update Cabal + cabal update + + # Build the CLI tool (not the top-level library package) + cd pandoc-cli + + # Clean previous builds + cabal clean + + # Configure and build + cabal build -j + + # Install the CLI executable + cabal install --installdir=/usr/local/bin --overwrite-policy=always + + # Verify installation + /usr/local/bin/pandoc --version -else - echo "Installing TeX Live from installer for $ARCH" +fi - # Download and install from official installer - curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz +if [[ "$ARCH" == "x86_64" ]]; then + # tex live installation + echo "Installing TexLive to allow PDf export from Notebooks" + curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz zcat < install-tl-unx.tar.gz | tar xf - cd install-tl-2* perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive cd /usr/local/texlive/bin/x86_64-linux ./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended -fi -# pandoc installation -curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz -mkdir -p /usr/local/pandoc -tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ -rm -f /tmp/pandoc.tar.gz + # pandoc installation + curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz + mkdir -p /usr/local/pandoc + tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ + rm -f /tmp/pandoc.tar.gz + +fi From 1c8cc56f39aa431a969baf8b5ab2da0954e3ed0a Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Fri, 27 Jun 2025 02:18:52 -0400 Subject: [PATCH 05/11] optimizing TeX Live & Pandoc install --- jupyter/utils/install_pdf_deps.sh | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/jupyter/utils/install_pdf_deps.sh b/jupyter/utils/install_pdf_deps.sh index d01bb0f77..84eb9f7eb 100755 --- a/jupyter/utils/install_pdf_deps.sh +++ b/jupyter/utils/install_pdf_deps.sh @@ -34,37 +34,36 @@ if [[ "$ARCH" == "ppc64le" ]]; then # Symlink for pdflatex cd /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu ln -s pdftex pdflatex + + # Cleanup TeX source to reduce image size + rm -rf /texlive-20250308-source /texlive-build + export PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:$PATH" pdflatex --version - # Install dependencies + # Install Pandoc from source dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm dnf install -y cabal-install ghc gmp-devel + # Set version PANDOC_VERSION=3.7.0.2 - - # Clone repo + cd /tmp git clone --recurse-submodules https://github.com/jgm/pandoc.git cd pandoc git checkout ${PANDOC_VERSION} git submodule update --init --recursive - - # Update Cabal + cabal update - - # Build the CLI tool (not the top-level library package) cd pandoc-cli - - # Clean previous builds - cabal clean - - # Configure and build - cabal build -j - - # Install the CLI executable - cabal install --installdir=/usr/local/bin --overwrite-policy=always - + cabal build -j$(nproc) + cabal install --installdir=/usr/local/bin --overwrite-policy=always --install-method=copy + + # Clean up Haskell build system + rm -rf ~/.cabal ~/.ghc /tmp/pandoc + dnf remove -y cabal-install ghc gmp-devel + dnf clean all && rm -rf /var/cache/dnf + # Verify installation /usr/local/bin/pandoc --version @@ -87,3 +86,4 @@ if [[ "$ARCH" == "x86_64" ]]; then rm -f /tmp/pandoc.tar.gz fi + From 2ca6f7dc02aac3b48bb7f0c4469cb6033108569b Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Thu, 3 Jul 2025 17:30:33 -0400 Subject: [PATCH 06/11] Add multistage Dockerfile with split PDF build into separate TeX Live and Pandoc scripts Signed-off-by: puneetsharma21 --- .../minimal/ubi9-python-3.11/Dockerfile.cpu | 27 ++++++++-- jupyter/utils/install_pandoc.sh | 39 ++++++++++++++ jupyter/utils/install_texlive.sh | 51 +++++++++++++++++++ 3 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 jupyter/utils/install_pandoc.sh create mode 100644 jupyter/utils/install_texlive.sh diff --git a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu index c5eab5d0b..467fc23da 100644 --- a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu @@ -1,3 +1,21 @@ +############################ +# Stage 1: PDF Tool Build # +############################ +FROM registry.access.redhat.com/ubi9/python-311:latest AS pdf-builder + +WORKDIR /opt/app-root/bin + +# OS Packages needs to be installed as root +USER 0 + +# Copy scripts +COPY jupyter/utils/install_texlive.sh ./install_texlive.sh +COPY jupyter/utils/install_pandoc.sh ./install_pandoc.sh +RUN chmod +x install_texlive.sh install_pandoc.sh + +RUN ./install_texlive.sh +RUN ./install_pandoc.sh + #################### # base # #################### @@ -47,9 +65,11 @@ COPY ${JUPYTER_REUSABLE_UTILS} utils/ USER 0 -# Dependencies for PDF export -RUN ./utils/install_pdf_deps.sh -ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" +# Copy built TeXLive and Pandoc binaries only (no build deps) +COPY --from=pdf-builder /usr/local/texlive /usr/local/texlive +COPY --from=pdf-builder /usr/local/pandoc /usr/local/pandoc + +ENV PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" USER 1001 @@ -74,3 +94,4 @@ RUN echo "Installing softwares and packages" && \ WORKDIR /opt/app-root/src ENTRYPOINT ["start-notebook.sh"] + diff --git a/jupyter/utils/install_pandoc.sh b/jupyter/utils/install_pandoc.sh new file mode 100644 index 000000000..ddc2487f7 --- /dev/null +++ b/jupyter/utils/install_pandoc.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -euxo pipefail + +ARCH=$(uname -m) + +if [[ "$ARCH" == "ppc64le" ]]; then + # Install Pandoc from source + dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + dnf install -y cabal-install ghc gmp-devel + + # Set version + PANDOC_VERSION=3.7.0.2 + + cd /tmp + git clone --recurse-submodules https://github.com/jgm/pandoc.git + cd pandoc + git checkout ${PANDOC_VERSION} + git submodule update --init --recursive + + cabal update + cd pandoc-cli + cabal build -j$(nproc) + cabal install --installdir=/usr/local --overwrite-policy=always --install-method=copy + + # Clean up Haskell build system + rm -rf ~/.cabal ~/.ghc /tmp/pandoc + dnf remove -y cabal-install ghc gmp-devel + dnf clean all && rm -rf /var/cache/dnf +fi + +if [[ "$ARCH" == "x86_64" ]]; then + # pandoc installation + curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz + mkdir -p /usr/local/pandoc + tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ + rm -f /tmp/pandoc.tar.gz +fi + +/usr/local/pandoc --version diff --git a/jupyter/utils/install_texlive.sh b/jupyter/utils/install_texlive.sh new file mode 100644 index 000000000..d63359b58 --- /dev/null +++ b/jupyter/utils/install_texlive.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -euxo pipefail + +ARCH=$(uname -m) + +if [[ "$ARCH" == "ppc64le" ]]; then + echo "Installing TeX Live from source for $ARCH" + + # Download and extract source + wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz + tar -xf texlive-20250308-source.tar.xz + cd texlive-20250308-source + + # Install build dependencies + dnf install -y gcc-toolset-13 perl make libX11-devel libXt-devel \ + zlib-devel freetype-devel libpng-devel ncurses-devel \ + gd-devel libtool wget tar xz bison flex libXaw-devel + + source /opt/rh/gcc-toolset-13/enable + + # Create build directory + mkdir ../texlive-build + cd ../texlive-build + + # Configure, build, install + ../texlive-20250308-source/configure --prefix=/usr/local/texlive + make -j$(nproc) + make install + + # Symlink for pdflatex + cd /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu + ln -s pdftex pdflatex + + # Cleanup TeX source to reduce image size + rm -rf /texlive-20250308-source /texlive-build + + export PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:$PATH" + pdflatex --version +fi + +if [[ "$ARCH" == "x86_64" ]]; then + # tex live installation + echo "Installing TexLive to allow PDf export from Notebooks" + curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz + zcat < install-tl-unx.tar.gz | tar xf - + cd install-tl-2* + perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive + cd /usr/local/texlive/bin/x86_64-linux + ./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended +fi + From fd58c5118f235b62092c0419d64de5d42b0d1c1f Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Wed, 9 Jul 2025 00:50:08 -0400 Subject: [PATCH 07/11] fix: add else condition for unsupported arch in install scripts Signed-off-by: puneetsharma21 --- jupyter/utils/install_pandoc.sh | 19 +++++++++++++------ jupyter/utils/install_texlive.sh | 10 +++++++--- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/jupyter/utils/install_pandoc.sh b/jupyter/utils/install_pandoc.sh index ddc2487f7..20ad9a1f7 100644 --- a/jupyter/utils/install_pandoc.sh +++ b/jupyter/utils/install_pandoc.sh @@ -19,21 +19,28 @@ if [[ "$ARCH" == "ppc64le" ]]; then cabal update cd pandoc-cli - cabal build -j$(nproc) - cabal install --installdir=/usr/local --overwrite-policy=always --install-method=copy + cabal build -j"$(nproc)" + mkdir -p /usr/local/pandoc/bin + cabal install \ + --installdir=/usr/local/pandoc/bin \ + --overwrite-policy=always \ + --install-method=copy # Clean up Haskell build system rm -rf ~/.cabal ~/.ghc /tmp/pandoc dnf remove -y cabal-install ghc gmp-devel dnf clean all && rm -rf /var/cache/dnf -fi -if [[ "$ARCH" == "x86_64" ]]; then + /usr/local/pandoc/bin/pandoc --version + +elif [[ "$ARCH" == "x86_64" ]]; then # pandoc installation curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz mkdir -p /usr/local/pandoc tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ rm -f /tmp/pandoc.tar.gz -fi -/usr/local/pandoc --version +else + echo "Unsupported architecture: $ARCH" >&2 + exit 1 +fi diff --git a/jupyter/utils/install_texlive.sh b/jupyter/utils/install_texlive.sh index d63359b58..b1573881a 100644 --- a/jupyter/utils/install_texlive.sh +++ b/jupyter/utils/install_texlive.sh @@ -24,7 +24,7 @@ if [[ "$ARCH" == "ppc64le" ]]; then # Configure, build, install ../texlive-20250308-source/configure --prefix=/usr/local/texlive - make -j$(nproc) + make -j"$(nproc)" make install # Symlink for pdflatex @@ -36,9 +36,8 @@ if [[ "$ARCH" == "ppc64le" ]]; then export PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:$PATH" pdflatex --version -fi -if [[ "$ARCH" == "x86_64" ]]; then +elif [[ "$ARCH" == "x86_64" ]]; then # tex live installation echo "Installing TexLive to allow PDf export from Notebooks" curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz @@ -47,5 +46,10 @@ if [[ "$ARCH" == "x86_64" ]]; then perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive cd /usr/local/texlive/bin/x86_64-linux ./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended + +else + echo "Unsupported architecture: $ARCH" >&2 + exit 1 + fi From b009cdd1ba5049a17fe3100a555ae4b86f700f7a Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Thu, 10 Jul 2025 06:37:06 -0400 Subject: [PATCH 08/11] fix: install TeX Live runtime via profile for ppc64le Signed-off-by: puneetsharma21 --- jupyter/utils/install_texlive.sh | 44 +++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/jupyter/utils/install_texlive.sh b/jupyter/utils/install_texlive.sh index b1573881a..43e48f91e 100644 --- a/jupyter/utils/install_texlive.sh +++ b/jupyter/utils/install_texlive.sh @@ -4,38 +4,58 @@ set -euxo pipefail ARCH=$(uname -m) if [[ "$ARCH" == "ppc64le" ]]; then - echo "Installing TeX Live from source for $ARCH" - - # Download and extract source - wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz - tar -xf texlive-20250308-source.tar.xz - cd texlive-20250308-source + echo "Installing TeX Live from source for $ARCH..." # Install build dependencies dnf install -y gcc-toolset-13 perl make libX11-devel libXt-devel \ zlib-devel freetype-devel libpng-devel ncurses-devel \ gd-devel libtool wget tar xz bison flex libXaw-devel + # Step 1: Download and extract the TeX Live source + wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz + tar -xf texlive-20250308-source.tar.xz + cd texlive-20250308-source + + # Enable newer GCC toolchain source /opt/rh/gcc-toolset-13/enable - # Create build directory + # Create build directory and build mkdir ../texlive-build cd ../texlive-build - - # Configure, build, install ../texlive-20250308-source/configure --prefix=/usr/local/texlive make -j"$(nproc)" make install # Symlink for pdflatex cd /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu - ln -s pdftex pdflatex + ln -sf pdftex pdflatex - # Cleanup TeX source to reduce image size + # Cleanup sources to reduce image size rm -rf /texlive-20250308-source /texlive-build - export PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:$PATH" + # Step 2: Run TeX Live installer for runtime tree setup + cd / + wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz + tar -xzf install-tl-unx.tar.gz + cd install-tl-2*/ + + # Create a custom install profile + TEXLIVE_INSTALL_PREFIX="/usr/local/texlive" + cat < texlive.profile +selected_scheme scheme-small +TEXDIR $TEXLIVE_INSTALL_PREFIX +TEXMFCONFIG ~/.texlive2025/texmf-config +TEXMFVAR ~/.texlive2025/texmf-var +option_doc 0 +option_src 0 +EOF + + ./install-tl --profile=texlive.profile --custom-bin=$TEXLIVE_INSTALL_PREFIX/bin/powerpc64le-unknown-linux-gnu + + # Set up environment + export PATH="$TEXLIVE_INSTALL_PREFIX/bin/powerpc64le-unknown-linux-gnu:$PATH" pdflatex --version + tlmgr --version elif [[ "$ARCH" == "x86_64" ]]; then # tex live installation From f124aa13d43a93a644a4de4b7f8852ddb0c1d295 Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Fri, 11 Jul 2025 09:31:34 -0400 Subject: [PATCH 09/11] Add PDF builder stage support to Python 3.12 minimal image Signed-off-by: puneetsharma21 --- .../minimal/ubi9-python-3.12/Dockerfile.cpu | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu index bfaa481ee..c3ebaa2e9 100644 --- a/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu @@ -1,3 +1,21 @@ +############################ +# Stage 1: PDF Tool Build # +############################ +FROM registry.access.redhat.com/ubi9/python-312:latest AS pdf-builder + +WORKDIR /opt/app-root/bin + +# OS Packages needs to be installed as root +USER 0 + +# Copy scripts +COPY jupyter/utils/install_texlive.sh ./install_texlive.sh +COPY jupyter/utils/install_pandoc.sh ./install_pandoc.sh +RUN chmod +x install_texlive.sh install_pandoc.sh + +RUN ./install_texlive.sh +RUN ./install_pandoc.sh + #################### # base # #################### @@ -47,9 +65,11 @@ COPY ${JUPYTER_REUSABLE_UTILS} utils/ USER 0 -# Dependencies for PDF export -RUN ./utils/install_pdf_deps.sh -ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" +# Copy built TeXLive and Pandoc binaries only (no build deps) +COPY --from=pdf-builder /usr/local/texlive /usr/local/texlive +COPY --from=pdf-builder /usr/local/pandoc /usr/local/pandoc + +ENV PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" USER 1001 From 510e5a0ce0f6f56c4e71bf79bdc3a58e0f5de53d Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Mon, 14 Jul 2025 05:52:17 -0400 Subject: [PATCH 10/11] Fix TeX Live PATH for multi-arch support (x86_64, ppc64le) Signed-off-by: puneetsharma21 --- .../minimal/ubi9-python-3.11/Dockerfile.cpu | 2 +- .../minimal/ubi9-python-3.12/Dockerfile.cpu | 2 +- jupyter/utils/install_pandoc.sh | 13 +++++-- jupyter/utils/install_texlive.sh | 35 +++++++++++++------ 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu index 467fc23da..50477dd0b 100644 --- a/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.11/Dockerfile.cpu @@ -69,7 +69,7 @@ USER 0 COPY --from=pdf-builder /usr/local/texlive /usr/local/texlive COPY --from=pdf-builder /usr/local/pandoc /usr/local/pandoc -ENV PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" +ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" USER 1001 diff --git a/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu b/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu index c3ebaa2e9..dd0cabbf5 100644 --- a/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu +++ b/jupyter/minimal/ubi9-python-3.12/Dockerfile.cpu @@ -69,7 +69,7 @@ USER 0 COPY --from=pdf-builder /usr/local/texlive /usr/local/texlive COPY --from=pdf-builder /usr/local/pandoc /usr/local/pandoc -ENV PATH="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu:/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" +ENV PATH="/usr/local/texlive/bin/linux:/usr/local/pandoc/bin:$PATH" USER 1001 diff --git a/jupyter/utils/install_pandoc.sh b/jupyter/utils/install_pandoc.sh index 20ad9a1f7..ae94ebc81 100644 --- a/jupyter/utils/install_pandoc.sh +++ b/jupyter/utils/install_pandoc.sh @@ -1,7 +1,14 @@ #!/bin/bash set -euxo pipefail -ARCH=$(uname -m) +# Mapping of `uname -m` values to equivalent GOARCH values +declare -A UNAME_TO_GOARCH +UNAME_TO_GOARCH["x86_64"]="amd64" +UNAME_TO_GOARCH["aarch64"]="arm64" +UNAME_TO_GOARCH["ppc64le"]="ppc64le" +UNAME_TO_GOARCH["s390x"]="s390x" + +ARCH="${UNAME_TO_GOARCH[$(uname -m)]}" if [[ "$ARCH" == "ppc64le" ]]; then # Install Pandoc from source @@ -33,9 +40,9 @@ if [[ "$ARCH" == "ppc64le" ]]; then /usr/local/pandoc/bin/pandoc --version -elif [[ "$ARCH" == "x86_64" ]]; then +elif [[ "$ARCH" == "amd64" ]]; then # pandoc installation - curl -L https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-amd64.tar.gz -o /tmp/pandoc.tar.gz + 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 mkdir -p /usr/local/pandoc tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ rm -f /tmp/pandoc.tar.gz diff --git a/jupyter/utils/install_texlive.sh b/jupyter/utils/install_texlive.sh index 43e48f91e..fa20d8c47 100644 --- a/jupyter/utils/install_texlive.sh +++ b/jupyter/utils/install_texlive.sh @@ -1,7 +1,14 @@ #!/bin/bash set -euxo pipefail -ARCH=$(uname -m) +# Mapping of `uname -m` values to equivalent GOARCH values +declare -A UNAME_TO_GOARCH +UNAME_TO_GOARCH["x86_64"]="amd64" +UNAME_TO_GOARCH["aarch64"]="arm64" +UNAME_TO_GOARCH["ppc64le"]="ppc64le" +UNAME_TO_GOARCH["s390x"]="s390x" + +ARCH="${UNAME_TO_GOARCH[$(uname -m)]}" if [[ "$ARCH" == "ppc64le" ]]; then echo "Installing TeX Live from source for $ARCH..." @@ -12,7 +19,8 @@ if [[ "$ARCH" == "ppc64le" ]]; then gd-devel libtool wget tar xz bison flex libXaw-devel # Step 1: Download and extract the TeX Live source - wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz + #wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz + wget --no-check-certificate https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz tar -xf texlive-20250308-source.tar.xz cd texlive-20250308-source @@ -27,9 +35,8 @@ if [[ "$ARCH" == "ppc64le" ]]; then make install # Symlink for pdflatex - cd /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu - ln -sf pdftex pdflatex - + ln -sf pdftex /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu/pdflatex + # Cleanup sources to reduce image size rm -rf /texlive-20250308-source /texlive-build @@ -52,19 +59,27 @@ EOF ./install-tl --profile=texlive.profile --custom-bin=$TEXLIVE_INSTALL_PREFIX/bin/powerpc64le-unknown-linux-gnu +# TeX Live binary directory +TEX_BIN_DIR="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu" + +# Create standard symlink 'linux' → arch-specific folder +ln -sf "$TEX_BIN_DIR" /usr/local/texlive/bin/linux + + # Set up environment - export PATH="$TEXLIVE_INSTALL_PREFIX/bin/powerpc64le-unknown-linux-gnu:$PATH" + export PATH="$TEXLIVE_INSTALL_PREFIX/bin/linux:$PATH" pdflatex --version tlmgr --version -elif [[ "$ARCH" == "x86_64" ]]; then +elif [[ "$ARCH" == "amd64" ]]; then # tex live installation - echo "Installing TexLive to allow PDf export from Notebooks" - curl -L https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz + echo "Installing TexLive to allow PDf export from Notebooks" + curl -fL https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz zcat < install-tl-unx.tar.gz | tar xf - cd install-tl-2* perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive - cd /usr/local/texlive/bin/x86_64-linux + mv /usr/local/texlive/bin/"$(uname -m)-linux" /usr/local/texlive/bin/linux + cd /usr/local/texlive/bin/linux ./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended else From 66732129fccf836c4ed05c5b23b7212498232c21 Mon Sep 17 00:00:00 2001 From: puneetsharma21 Date: Mon, 14 Jul 2025 07:21:39 -0400 Subject: [PATCH 11/11] Fix TeX Live and Pandoc for multi-arch support Signed-off-by: puneetsharma21 --- jupyter/utils/install_texlive.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jupyter/utils/install_texlive.sh b/jupyter/utils/install_texlive.sh index fa20d8c47..3f0c19053 100644 --- a/jupyter/utils/install_texlive.sh +++ b/jupyter/utils/install_texlive.sh @@ -19,8 +19,7 @@ if [[ "$ARCH" == "ppc64le" ]]; then gd-devel libtool wget tar xz bison flex libXaw-devel # Step 1: Download and extract the TeX Live source - #wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz - wget --no-check-certificate https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz + wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz tar -xf texlive-20250308-source.tar.xz cd texlive-20250308-source