-
Notifications
You must be signed in to change notification settings - Fork 486
cache docker image in github ci #2929
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same logic, just reordered |
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same logic, just reordered |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,10 +18,10 @@ ARG BASE_IMAGE_SPARK_VERSION=4.0.1 | |
| FROM apache/spark:${BASE_IMAGE_SPARK_VERSION} | ||
|
|
||
| # Dependency versions - keep these compatible | ||
| # Changing these will invalidate the JAR download cache layer | ||
| ARG ICEBERG_VERSION=1.10.1 | ||
| ARG ICEBERG_SPARK_RUNTIME_VERSION=4.0_2.13 | ||
| ARG HADOOP_VERSION=3.4.1 | ||
| ARG SCALA_VERSION=2.13 | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unreferenced, so removing |
||
| ARG AWS_SDK_VERSION=2.24.6 | ||
| ARG MAVEN_MIRROR=https://repo.maven.apache.org/maven2 | ||
|
|
||
|
|
@@ -31,26 +31,23 @@ WORKDIR ${SPARK_HOME} | |
| # Install curl for JAR downloads | ||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends curl && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Copy configuration (early for better caching) | ||
| COPY --chown=spark:spark spark-defaults.conf ${SPARK_HOME}/conf/ | ||
|
|
||
| # Create event log directory | ||
| # Create directories (separate layer) | ||
| RUN mkdir -p /home/iceberg/spark-events && \ | ||
| chown -R spark:spark /home/iceberg | ||
|
|
||
| # Required JAR dependencies | ||
| ENV JARS_TO_DOWNLOAD="\ | ||
| org/apache/iceberg/iceberg-spark-runtime-${ICEBERG_SPARK_RUNTIME_VERSION}/${ICEBERG_VERSION}/iceberg-spark-runtime-${ICEBERG_SPARK_RUNTIME_VERSION}-${ICEBERG_VERSION}.jar \ | ||
| org/apache/iceberg/iceberg-aws-bundle/${ICEBERG_VERSION}/iceberg-aws-bundle-${ICEBERG_VERSION}.jar \ | ||
| org/apache/hadoop/hadoop-aws/${HADOOP_VERSION}/hadoop-aws-${HADOOP_VERSION}.jar \ | ||
| software/amazon/awssdk/bundle/${AWS_SDK_VERSION}/bundle-${AWS_SDK_VERSION}.jar" | ||
|
|
||
| # Download JARs with retry logic | ||
| # Download JARs with retry logic (most cacheable - only changes when versions change) | ||
| # This is the slowest step, so we do it before copying config files | ||
| RUN set -e && \ | ||
| cd "${SPARK_HOME}/jars" && \ | ||
| for jar_path in ${JARS_TO_DOWNLOAD}; do \ | ||
| for jar_path in \ | ||
| "org/apache/iceberg/iceberg-spark-runtime-${ICEBERG_SPARK_RUNTIME_VERSION}/${ICEBERG_VERSION}/iceberg-spark-runtime-${ICEBERG_SPARK_RUNTIME_VERSION}-${ICEBERG_VERSION}.jar" \ | ||
| "org/apache/iceberg/iceberg-aws-bundle/${ICEBERG_VERSION}/iceberg-aws-bundle-${ICEBERG_VERSION}.jar" \ | ||
| "org/apache/hadoop/hadoop-aws/${HADOOP_VERSION}/hadoop-aws-${HADOOP_VERSION}.jar" \ | ||
| "software/amazon/awssdk/bundle/${AWS_SDK_VERSION}/bundle-${AWS_SDK_VERSION}.jar"; \ | ||
| do \ | ||
| jar_name=$(basename "${jar_path}") && \ | ||
| echo "Downloading ${jar_name}..." && \ | ||
| curl -fsSL --retry 3 --retry-delay 5 \ | ||
|
|
@@ -60,6 +57,9 @@ RUN set -e && \ | |
| done && \ | ||
| chown -R spark:spark "${SPARK_HOME}/jars" | ||
|
|
||
| # Copy configuration last (changes more frequently than JARs) | ||
| COPY --chown=spark:spark spark-defaults.conf ${SPARK_HOME}/conf/ | ||
|
|
||
| USER spark | ||
| WORKDIR ${SPARK_HOME} | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs for
cache-fromandcache-to:https://docs.docker.com/reference/cli/docker/buildx/build/#cache-from
https://docs.docker.com/reference/cli/docker/buildx/build/#cache-to