This is an automated email from the ASF dual-hosted git repository.

lresende pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-toree.git


The following commit(s) were added to refs/heads/master by this push:
     new b70d4d5d Switch from Oracle JDK to OpenJDK in Dockerfile (#251)
b70d4d5d is described below

commit b70d4d5d341545f4f0235077aacf7ddb777f2ffc
Author: Cheng Pan <[email protected]>
AuthorDate: Tue Mar 10 03:07:01 2026 +0800

    Switch from Oracle JDK to OpenJDK in Dockerfile (#251)
---
 Dockerfile           | 40 ++++++++++++++++++++--------------------
 Dockerfile.toree-dev | 32 +++++++++++++++++++-------------
 2 files changed, 39 insertions(+), 33 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 9b2eb1a7..bec2dd02 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -32,26 +32,26 @@ ARG SCALA_VERSION=2.12
 RUN apt-get -y update && \
     apt-get -y install software-properties-common
 
-RUN \
-    echo "===> add webupd8 repository..."  && \
-    echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | 
tee /etc/apt/sources.list.d/webupd8team-java.list  && \
-    echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty 
main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list  && \
-    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886  && \
-    apt-get update
-
-RUN echo "===> install Java"  && \
-    echo debconf shared/accepted-oracle-license-v1-1 select true | 
debconf-set-selections  && \
-    echo debconf shared/accepted-oracle-license-v1-1 seen true | 
debconf-set-selections  && \
-    DEBIAN_FRONTEND=noninteractive  apt-get install -y --force-yes 
oracle-java8-installer oracle-java8-set-default && \
-    apt-get clean && \
-    update-java-alternatives -s java-8-oracle
-
-RUN cd /tmp && \
-    if [ "$SCALA_VERSION" = "2.13" ]; then 
APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13; else 
APACHE_SPARK_CUSTOM_NAME=hadoop3; fi && \
-    wget -q 
https://archive.apache.org/dist/spark/spark-${APACHE_SPARK_VERSION}/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz
 && \
-    tar xzf spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz 
-C /usr/local && \
-    rm spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz && \
-    ln -snf 
/usr/local/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} 
/usr/local/spark
+RUN JAVA_8=`update-alternatives --list java | grep java-1.8.0-openjdk` || echo 
$JAVA_8 && \
+    if [ "x$JAVA_8" = "x" ]; then \
+        apt-get -y update ; \
+        apt-get install -y --no-install-recommends openjdk-8-jdk 
ca-certificates-java ; \
+        apt-get clean ; \
+        rm -rf /var/lib/apt/lists/* ; \
+        update-ca-certificates -f ; \
+        JAVA_8=`update-java-alternatives --list | grep java-1.8.0-openjdk | 
awk '{print $NF}'` ; \
+        update-java-alternatives --set $JAVA_8 ; \
+    fi
+
+RUN if [ "$SCALA_VERSION" = "2.13" ]; then 
APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13; else 
APACHE_SPARK_CUSTOM_NAME=hadoop3; fi && \
+    
SPARK_TGZ_NAME=spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} && 
\
+    if [ ! -d "/usr/local/$SPARK_TGZ_NAME" ]; then \
+        cd /tmp ; \
+        wget -q 
https://www.apache.org/dyn/closer.lua/spark/spark-${APACHE_SPARK_VERSION}/${SPARK_TGZ_NAME}.tgz?action=download
 -O ${SPARK_TGZ_NAME}.tgz ; \
+        tar -xzf ${SPARK_TGZ_NAME}.tgz -C /usr/local ; \
+        rm ${SPARK_TGZ_NAME}.tgz ; \
+        ln -snf /usr/local/$SPARK_TGZ_NAME /usr/local/spark ; \
+    fi
 
 # R support
 RUN apt-get update && \
diff --git a/Dockerfile.toree-dev b/Dockerfile.toree-dev
index 731b9c83..8cb291f9 100644
--- a/Dockerfile.toree-dev
+++ b/Dockerfile.toree-dev
@@ -26,21 +26,27 @@ USER root
 ARG APACHE_SPARK_VERSION=3.4.4
 ARG SCALA_VERSION=2.12
 
-RUN apt-get -y update && \
-    apt-get install -y --no-install-recommends openjdk-8-jdk 
ca-certificates-java  && \
-    apt-get clean && \
-    rm -rf /var/lib/apt/lists/* && \
-    update-ca-certificates -f && \
-    JAVA_8=`update-alternatives --list java | grep java-8-openjdk` && \
-    update-alternatives --set java $JAVA_8
+RUN JAVA_8=`update-alternatives --list java | grep java-1.8.0-openjdk` || echo 
$JAVA_8 && \
+    if [ "x$JAVA_8" = "x" ]; then \
+        apt-get -y update ; \
+        apt-get install -y --no-install-recommends openjdk-8-jdk 
ca-certificates-java ; \
+        apt-get clean ; \
+        rm -rf /var/lib/apt/lists/* ; \
+        update-ca-certificates -f ; \
+        JAVA_8=`update-java-alternatives --list | grep java-1.8.0-openjdk | 
awk '{print $NF}'` ; \
+        update-java-alternatives --set $JAVA_8 ; \
+    fi
 
 # Installing Spark3
-RUN cd /tmp && \
-    if [ "$SCALA_VERSION" = "2.13" ]; then 
APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13; else 
APACHE_SPARK_CUSTOM_NAME=hadoop3; fi && \
-    wget -q 
https://archive.apache.org/dist/spark/spark-${APACHE_SPARK_VERSION}/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz
 && \
-    tar xzf spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz 
-C /usr/local && \
-    rm spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME}.tgz && \
-    ln -snf 
/usr/local/spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} 
/usr/local/spark
+RUN if [ "$SCALA_VERSION" = "2.13" ]; then 
APACHE_SPARK_CUSTOM_NAME=hadoop3-scala2.13; else 
APACHE_SPARK_CUSTOM_NAME=hadoop3; fi && \
+    
SPARK_TGZ_NAME=spark-${APACHE_SPARK_VERSION}-bin-${APACHE_SPARK_CUSTOM_NAME} && 
\
+    if [ ! -d "/usr/local/$SPARK_TGZ_NAME" ]; then \
+        cd /tmp ; \
+        wget -q 
https://www.apache.org/dyn/closer.lua/spark/spark-${APACHE_SPARK_VERSION}/${SPARK_TGZ_NAME}.tgz?action=download
 -O ${SPARK_TGZ_NAME}.tgz ; \
+        tar -xzf ${SPARK_TGZ_NAME}.tgz -C /usr/local ; \
+        rm ${SPARK_TGZ_NAME}.tgz ; \
+        ln -snf /usr/local/$SPARK_TGZ_NAME /usr/local/spark ; \
+    fi
 
 # Remove other scala kernels
 RUN cd /opt/conda/share/jupyter/kernels/ && \

Reply via email to