From 94346cc5c12e5b4410c7ee68083c596cdd708085 Mon Sep 17 00:00:00 2001
From: Vincent Massol <vincent@massol.net>
Date: Thu, 27 Jun 2019 10:41:38 +0200
Subject: [PATCH] XDOCKER-112: Switch to Tomcat on Oracle JDK 8.x to
 AdoptOpenJDK 11.x * And switch to AdoptOpenJDK 8.x for XWiki 10.x (since
 XWiki 10.x doesn't support Java 11)

---
 10/mysql-tomcat/Dockerfile          | 2 +-
 10/postgres-tomcat/Dockerfile       | 2 +-
 template/Dockerfile                 | 6 +++++-
 template/xwiki/docker-entrypoint.sh | 1 +
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/10/mysql-tomcat/Dockerfile b/10/mysql-tomcat/Dockerfile
index b94362b..82c4f0b 100644
--- a/10/mysql-tomcat/Dockerfile
+++ b/10/mysql-tomcat/Dockerfile
@@ -17,7 +17,7 @@
 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 # ---------------------------------------------------------------------------
-FROM tomcat:8-jdk11-adoptopenjdk-hotspot
+FROM tomcat:8-jdk8-adoptopenjdk-hotspot
 
 #    ____  ____  ____      ____  _   __        _
 #   |_  _||_  _||_  _|    |_  _|(_) [  |  _   (_)
diff --git a/10/postgres-tomcat/Dockerfile b/10/postgres-tomcat/Dockerfile
index 9714104..bdc2567 100644
--- a/10/postgres-tomcat/Dockerfile
+++ b/10/postgres-tomcat/Dockerfile
@@ -17,7 +17,7 @@
 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 # ---------------------------------------------------------------------------
-FROM tomcat:8-jdk11-adoptopenjdk-hotspot
+FROM tomcat:8-jdk8-adoptopenjdk-hotspot
 
 #    ____  ____  ____      ____  _   __        _
 #   |_  _||_  _||_  _|    |_  _|(_) [  |  _   (_)
diff --git a/template/Dockerfile b/template/Dockerfile
index 8964064..1a7546e 100644
--- a/template/Dockerfile
+++ b/template/Dockerfile
@@ -17,7 +17,11 @@
 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 # ---------------------------------------------------------------------------
-FROM tomcat:8-jdk11-adoptopenjdk-hotspot
+<% if (xwikiVersion.startsWith('10.'))
+     print 'FROM tomcat:8-jdk8-adoptopenjdk-hotspot'
+   else
+     print 'FROM tomcat:8-jdk11-adoptopenjdk-hotspot'
+%>
 
 #    ____  ____  ____      ____  _   __        _
 #   |_  _||_  _||_  _|    |_  _|(_) [  |  _   (_)
diff --git a/template/xwiki/docker-entrypoint.sh b/template/xwiki/docker-entrypoint.sh
index 4c769e3..f158119 100755
--- a/template/xwiki/docker-entrypoint.sh
+++ b/template/xwiki/docker-entrypoint.sh
@@ -120,6 +120,7 @@ function configure() {
   safesed "replacepassword" \$DB_PASSWORD /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
   safesed "replacecontainer" \$DB_HOST /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
   safesed "replacedatabase" \$DB_DATABASE /usr/local/tomcat/webapps/ROOT/WEB-INF/hibernate.cfg.xml
+
   echo '  Generating authentication validation and encryption keys...'
   xwiki_set_cfg 'xwiki.authentication.validationKey' "\$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
   xwiki_set_cfg 'xwiki.authentication.encryptionKey' "\$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
-- 
GitLab