Skip to content

Commit 54e0fd2

Browse files
committed
[SPARK-51520][K8S] Use JRE to reduce image size
Signed-off-by: Jacob Salway <[email protected]>
1 parent 629d167 commit 54e0fd2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

build-tools/docker/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,18 @@
1515
# limitations under the License.
1616
#
1717
FROM gradle:8.13-jdk17-noble AS builder
18+
1819
WORKDIR /app
20+
1921
COPY . .
20-
RUN ./gradlew clean build -x check
2122

22-
FROM azul/zulu-openjdk:21
23+
RUN --mount=type=cache,target=/home/gradle/.gradle/caches gradle --no-daemon clean build -x check
24+
25+
FROM azul/zulu-openjdk:21-jre
26+
2327
ARG APP_VERSION=0.1.0-SNAPSHOT
2428
ARG SPARK_UID=185
29+
2530
LABEL org.opencontainers.image.authors="Apache Spark project <[email protected]>"
2631
LABEL org.opencontainers.image.licenses="Apache-2.0"
2732
LABEL org.opencontainers.image.ref.name="Apache Spark Kubernetes Operator"
@@ -32,14 +37,16 @@ ENV SPARK_OPERATOR_WORK_DIR=/opt/spark-operator/operator
3237
ENV SPARK_OPERATOR_JAR=spark-kubernetes-operator.jar
3338

3439
WORKDIR $SPARK_OPERATOR_WORK_DIR
40+
3541
RUN groupadd --system --gid=$SPARK_UID spark && \
3642
useradd --system --home-dir $SPARK_OPERATOR_HOME --uid=$SPARK_UID --gid=spark spark && \
3743
chown -R spark:spark $SPARK_OPERATOR_HOME
3844

3945
COPY --from=builder --chown=spark:spark /app/spark-operator/build/libs/spark-kubernetes-operator-$APP_VERSION-all.jar $SPARK_OPERATOR_JAR
4046
COPY --from=builder --chown=spark:spark /app/build-tools/docker/docker-entrypoint.sh .
4147

42-
4348
USER spark
49+
4450
ENTRYPOINT ["/opt/spark-operator/operator/docker-entrypoint.sh"]
51+
4552
CMD ["help"]

0 commit comments

Comments
 (0)