Repository navigation
[Feature] Add Spark 4 platform images #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
royischoss
merged 5 commits into
mlrun:development
from
gtopper:feature/ML-13080-isolated-spark4-images
Sep 23, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6691f55
[Feature] Add Spark 4 platform images
639138b
Enforce Spark 4 image configuration parity
9f537b3
Clarify Spark 4 image parity and selection
df3768d
Add cloud connectors to Spark 4 images
a9d665c
Fix duplicate detection for Scala connector JARs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # check=skip=InvalidDefaultArgInFrom | ||
| # Copyright 2026 Iguazio | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # Spark 4 counterpart of ./Dockerfile. | ||
| # Spark 4.2.0, Scala 2.13, Temurin JDK 25, Hadoop 3.5.0 as bundled by the | ||
| # pinned upstream image. | ||
|
|
||
| # Required build argument; the Makefile supplies the pinned base reference. | ||
| ARG SPARK4_BASE_IMAGE | ||
| FROM ${SPARK4_BASE_IMAGE} | ||
|
|
||
| USER root | ||
|
|
||
| # Shared with the Spark 4 CUDA image. | ||
| COPY scripts/ce-customize-spark4.sh /tmp/ce-customize-spark4.sh | ||
| COPY scripts/jars-4.2.0.txt /tmp/jars-4.2.0.txt | ||
| RUN chmod +x /tmp/ce-customize-spark4.sh && \ | ||
| /tmp/ce-customize-spark4.sh /tmp/jars-4.2.0.txt && \ | ||
| rm -f /tmp/ce-customize-spark4.sh /tmp/jars-4.2.0.txt | ||
|
|
||
| USER spark |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # check=skip=InvalidDefaultArgInFrom | ||
| # Copyright 2026 Iguazio | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # CUDA counterpart of ./Dockerfile.spark4. The Spark distribution, the JDK, | ||
| # and the entrypoint are copied from the same digest-pinned base image the | ||
| # regular Spark 4 image is built from, so the two variants cannot drift and | ||
| # the build does not download Spark or the JDK a second time. | ||
|
|
||
| # Required build arguments; the Makefile supplies the pinned base references. | ||
| ARG SPARK4_BASE_IMAGE | ||
| ARG SPARK4_CUDA_BASE_IMAGE | ||
|
|
||
| FROM ${SPARK4_BASE_IMAGE} AS spark4 | ||
|
|
||
| FROM ${SPARK4_CUDA_BASE_IMAGE} | ||
|
|
||
| # CUDA_VERSION and NV_CUDNN_VERSION are the CUDA base image's own environment. | ||
| # Do not declare an ARG of either name here: it would shadow the inherited | ||
| # value and let the labels describe a base this image was not built on. | ||
| LABEL com.iguazio.cuda-version="${CUDA_VERSION}" \ | ||
| com.iguazio.cudnn-version="${NV_CUDNN_VERSION}" | ||
|
|
||
| ARG spark_uid=185 | ||
|
|
||
| RUN groupadd --system --gid=${spark_uid} spark && \ | ||
| useradd --system --uid=${spark_uid} --gid=spark -d /nonexistent spark | ||
|
|
||
| # Packages the upstream Spark image provides and the CUDA base does not. | ||
| # `locales` is one of them: the CUDA base generates only C and C.utf8, so | ||
| # en_US.UTF-8 has to be generated here for the locale ENV below to be valid. | ||
| RUN set -ex; \ | ||
| export DEBIAN_FRONTEND=noninteractive; \ | ||
| apt-get update; \ | ||
| apt-get install -y --no-install-recommends \ | ||
| gnupg2 bash tini libc6 libpam-modules \ | ||
| krb5-user libnss3 procps net-tools gosu libnss-wrapper libjemalloc2 \ | ||
| locales; \ | ||
| locale-gen en_US.UTF-8; \ | ||
| echo "auth required pam_wheel.so use_uid" >> /etc/pam.d/su; \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # COPY carries no image environment, so the runtime settings from the Spark | ||
| # base are restated here. SPARK_TGZ_URL, SPARK_TGZ_ASC_URL, and GPG_KEY are | ||
| # build-provenance metadata and are intentionally omitted. | ||
| ENV LANG=en_US.UTF-8 \ | ||
| LANGUAGE=en_US:en \ | ||
| LC_ALL=en_US.UTF-8 | ||
|
|
||
| COPY --from=spark4 /opt/java/openjdk /opt/java/openjdk | ||
| COPY --from=spark4 /opt/spark /opt/spark | ||
| COPY --from=spark4 /opt/decom.sh /opt/decom.sh | ||
| COPY --from=spark4 /opt/entrypoint.sh /opt/entrypoint.sh | ||
|
|
||
| # COPY creates the destination directory itself as root, while its contents | ||
| # keep the source image's ownership. Restore the Spark base's owner on the | ||
| # directory so the two variants match exactly. | ||
| RUN chown spark:spark /opt/spark | ||
|
|
||
| ENV JAVA_HOME=/opt/java/openjdk \ | ||
| JAVA_VERSION=jdk-25.0.4+7 \ | ||
| SPARK_HOME=/opt/spark | ||
| ENV PATH="${JAVA_HOME}/bin:${PATH}" | ||
|
|
||
| WORKDIR /opt/spark/work-dir | ||
|
|
||
| # Shared with the regular Spark 4 image. | ||
| COPY scripts/ce-customize-spark4.sh /tmp/ce-customize-spark4.sh | ||
| COPY scripts/jars-4.2.0.txt /tmp/jars-4.2.0.txt | ||
| RUN chmod +x /tmp/ce-customize-spark4.sh && \ | ||
| /tmp/ce-customize-spark4.sh /tmp/jars-4.2.0.txt && \ | ||
| rm -f /tmp/ce-customize-spark4.sh /tmp/jars-4.2.0.txt | ||
|
|
||
| USER spark | ||
|
|
||
| ENTRYPOINT [ "/opt/entrypoint.sh" ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/bin/bash | ||
| # Copyright 2026 Iguazio | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # Spark 4 counterpart of ce-customize.sh. Installs Python 3.11, connector JARs | ||
| # from the supplied manifest, and a writable home directory for the spark user. | ||
| set -ex | ||
| export DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| JAR_MANIFEST="${1:?usage: ce-customize-spark4.sh <jar-manifest>}" | ||
|
|
||
| apt-get update | ||
| apt-get install -y --no-install-recommends software-properties-common curl ca-certificates gnupg | ||
| add-apt-repository -y ppa:deadsnakes/ppa | ||
| apt-get update | ||
| apt-get install -y python3.11 python3.11-distutils git | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py | ||
| python3.11 /tmp/get-pip.py | ||
| rm -f /tmp/get-pip.py | ||
|
|
||
| while read -r line || [ -n "$line" ]; do | ||
| url="${line%%#*}" | ||
| url="$(echo "$url" | tr -d '[:space:]')" | ||
| [ -z "$url" ] && continue | ||
| case "$url" in | ||
| https://*) ;; | ||
| *) echo "bad manifest line: $line" >&2; exit 1 ;; | ||
| esac | ||
| curl -fsSL -o "/opt/spark/jars/$(basename "$url")" "$url" | ||
| done < "$JAR_MANIFEST" | ||
|
|
||
| update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 | ||
| ln -sf /usr/bin/python3 /usr/bin/python | ||
|
|
||
| usermod -d /home/spark spark | ||
| mkdir -p /home/spark | ||
| chown spark:spark /home/spark |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.