diff --git a/jupyter/datascience/ubi9-python-3.12/Dockerfile.cpu b/jupyter/datascience/ubi9-python-3.12/Dockerfile.cpu index d70a57a4fd..8887361cd2 100644 --- a/jupyter/datascience/ubi9-python-3.12/Dockerfile.cpu +++ b/jupyter/datascience/ubi9-python-3.12/Dockerfile.cpu @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage with s390x support ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -33,6 +34,8 @@ else fi EOF +### END mongocli-builder stage with s390x support + #################### # cpu-base # #################### @@ -337,8 +340,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/datascience/ubi9-python-3.12/Dockerfile.konflux.cpu b/jupyter/datascience/ubi9-python-3.12/Dockerfile.konflux.cpu index 044d6023df..464cf451a3 100644 --- a/jupyter/datascience/ubi9-python-3.12/Dockerfile.konflux.cpu +++ b/jupyter/datascience/ubi9-python-3.12/Dockerfile.konflux.cpu @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage with s390x support ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -33,6 +34,8 @@ else fi EOF +### END mongocli-builder stage with s390x support + #################### # cpu-base # #################### @@ -335,8 +338,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.cuda b/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.cuda index 55ff8aa5c2..4c17c4de99 100644 --- a/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.cuda +++ b/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.cuda @@ -5,6 +5,7 @@ ARG TARGETARCH ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -21,6 +22,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # cuda-base # #################### @@ -125,8 +128,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.konflux.cuda b/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.konflux.cuda index 560c9e3f28..ad89873b7d 100644 --- a/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.konflux.cuda +++ b/jupyter/pytorch+llmcompressor/ubi9-python-3.12/Dockerfile.konflux.cuda @@ -5,6 +5,7 @@ ARG TARGETARCH ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -21,6 +22,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # cuda-base # #################### @@ -125,8 +128,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda b/jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda index 4163af701c..6e925774f7 100644 --- a/jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda +++ b/jupyter/pytorch/ubi9-python-3.12/Dockerfile.cuda @@ -5,6 +5,7 @@ ARG TARGETARCH ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -21,6 +22,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # cuda-base # #################### @@ -125,8 +128,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/pytorch/ubi9-python-3.12/Dockerfile.konflux.cuda b/jupyter/pytorch/ubi9-python-3.12/Dockerfile.konflux.cuda index 17c6a688fd..4585fae64e 100644 --- a/jupyter/pytorch/ubi9-python-3.12/Dockerfile.konflux.cuda +++ b/jupyter/pytorch/ubi9-python-3.12/Dockerfile.konflux.cuda @@ -5,6 +5,7 @@ ARG TARGETARCH ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -21,6 +22,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # cuda-base # #################### @@ -125,8 +128,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.konflux.rocm b/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.konflux.rocm index 0bee19f62d..3a1b150811 100644 --- a/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.konflux.rocm +++ b/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.konflux.rocm @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -19,6 +20,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # rocm-base # #################### @@ -131,8 +134,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.rocm b/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.rocm index 55de8b97c7..e72394e373 100644 --- a/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.rocm +++ b/jupyter/rocm/pytorch/ubi9-python-3.12/Dockerfile.rocm @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -19,6 +20,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # rocm-base # #################### @@ -131,8 +134,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.konflux.rocm b/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.konflux.rocm index bc2006c7d7..c98545942b 100644 --- a/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.konflux.rocm +++ b/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.konflux.rocm @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -19,6 +20,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # rocm-base # #################### @@ -131,8 +134,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.rocm b/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.rocm index f7e0f928b4..b1770beaa7 100644 --- a/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.rocm +++ b/jupyter/rocm/tensorflow/ubi9-python-3.12/Dockerfile.rocm @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -19,6 +20,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # rocm-base # #################### @@ -131,8 +134,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.cuda b/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.cuda index 133b33204f..6ec0e7d8d8 100644 --- a/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.cuda +++ b/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.cuda @@ -5,6 +5,7 @@ ARG TARGETARCH ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -21,6 +22,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # cuda-base # #################### @@ -133,8 +136,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.konflux.cuda b/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.konflux.cuda index 185da44d59..7c0667587d 100644 --- a/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.konflux.cuda +++ b/jupyter/tensorflow/ubi9-python-3.12/Dockerfile.konflux.cuda @@ -5,6 +5,7 @@ ARG TARGETARCH ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -21,6 +22,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # cuda-base # #################### @@ -133,8 +136,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/trustyai/ubi9-python-3.12/Dockerfile.cpu b/jupyter/trustyai/ubi9-python-3.12/Dockerfile.cpu index 66b24b0b10..18bf0e888a 100644 --- a/jupyter/trustyai/ubi9-python-3.12/Dockerfile.cpu +++ b/jupyter/trustyai/ubi9-python-3.12/Dockerfile.cpu @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -19,6 +20,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # wheel-cache-base # #################### @@ -164,8 +167,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/jupyter/trustyai/ubi9-python-3.12/Dockerfile.konflux.cpu b/jupyter/trustyai/ubi9-python-3.12/Dockerfile.konflux.cpu index 5d8ec29d04..559ee4ebb7 100644 --- a/jupyter/trustyai/ubi9-python-3.12/Dockerfile.konflux.cpu +++ b/jupyter/trustyai/ubi9-python-3.12/Dockerfile.konflux.cpu @@ -3,6 +3,7 @@ ######################### ARG BASE_IMAGE +### BEGIN mongocli-builder stage ###################################################### # mongocli-builder (build stage only, not published) # ###################################################### @@ -19,6 +20,8 @@ cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ EOF +### END mongocli-builder stage + #################### # wheel-cache-base # #################### @@ -163,8 +166,10 @@ dnf clean all rm -rf /var/cache/yum EOF +### BEGIN Copy mongocli from builder # Copy dynamically-linked mongocli built in earlier build stage COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/ +### END Copy mongocli from builder # Other apps and tools installed as default user USER 1001 diff --git a/scripts/dockerfile_fragments.py b/scripts/dockerfile_fragments.py index d494ab4ddf..1e443dc0b1 100755 --- a/scripts/dockerfile_fragments.py +++ b/scripts/dockerfile_fragments.py @@ -102,6 +102,58 @@ def main(): # Prevent Elyra from re-installing the dependencies ENV ELYRA_INSTALL_PACKAGES="false" """), + + "mongocli-builder stage": textwrap.dedent(r""" + ###################################################### + # mongocli-builder (build stage only, not published) # + ###################################################### + FROM registry.access.redhat.com/ubi9/go-toolset:latest AS mongocli-builder + + ARG MONGOCLI_VERSION=2.0.4 + + WORKDIR /tmp/ + RUN /bin/bash <<'EOF' + set -Eeuxo pipefail + curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mongodb/mongodb-cli/archive/refs/tags/mongocli/v${MONGOCLI_VERSION}.zip + unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip + cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ + CGO_ENABLED=1 GOOS=linux go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ + EOF + """), + "mongocli-builder stage with s390x support": textwrap.dedent(r""" + ###################################################### + # mongocli-builder (build stage only, not published) # + ###################################################### + FROM registry.access.redhat.com/ubi9/go-toolset:latest AS mongocli-builder + + ARG MONGOCLI_VERSION=2.0.4 + + WORKDIR /tmp/ + + ARG TARGETARCH + + # Keep s390x special-case from original (create dummy binary) but + # include explicit curl/unzip steps from the delta for non-s390x. + RUN /bin/bash <<'EOF' + set -Eeuxo pipefail + arch="${TARGETARCH:-$(uname -m)}" + arch=$(echo "$arch" | cut -d- -f1) + if [ "$arch" = "s390x" ]; then + echo "Skipping mongocli build for ${arch}, creating dummy binary" + mkdir -p /tmp && printf '#!/bin/sh\necho "mongocli not supported on s390x"\n' > /tmp/mongocli + chmod +x /tmp/mongocli + else + echo "Building mongocli for ${arch}" + curl -Lo mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip https://github.com/mongodb/mongodb-cli/archive/refs/tags/mongocli/v${MONGOCLI_VERSION}.zip + unzip ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}.zip + cd ./mongodb-cli-mongocli-v${MONGOCLI_VERSION}/ + CGO_ENABLED=1 GOOS=linux GOARCH=${arch} GO111MODULE=on go build -a -tags strictfipsruntime -o /tmp/mongocli ./cmd/mongocli/ + fi + EOF + """), + "Copy mongocli from builder": textwrap.dedent(r""" + # Copy dynamically-linked mongocli built in earlier build stage + COPY --from=mongocli-builder /tmp/mongocli /opt/app-root/bin/"""), } for docker_dir in docker_directories: