From f47e6018319a25f9d704d75b366a4ff347898ea3 Mon Sep 17 00:00:00 2001
From: David Beniamine <david.beniamine@tetras-libre.fr>
Date: Tue, 1 Apr 2025 16:39:20 +0200
Subject: [PATCH] Add option to install a specific JDK

---
 .env.sample            | 2 ++
 docker-compose.yml     | 4 ++--
 docker/kasm/Dockerfile | 6 ++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/.env.sample b/.env.sample
index d557009..5e3e1e7 100644
--- a/.env.sample
+++ b/.env.sample
@@ -23,6 +23,8 @@ TZ=Europe/Paris
 ANACONDA=true
 # Install QGIS
 QGIS=true
+# Install JAVA tell which jdk ie default-jdk openjdk-8 etc.
+JAVA=
 # Should the user have sudo rights
 # **only home is a volume, any modifcation in other FS will be lost**
 SUDO=false
diff --git a/docker-compose.yml b/docker-compose.yml
index 96369d5..150ccd3 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,8 +6,8 @@ services:
       args:
         - QGIS=${QGIS}
         - ANACONDA=${ANACONDA}
-    image: "webtop-ubuntu-mate:anaconda-${ANACONDA}_QGIS-${QGIS}_SUDO-${SUDO}"
-    #image: lscr.io/linuxserver/webtop:ubuntu-mate
+        - JAVA=${JAVA}
+    image: "webtop-ubuntu-mate:anaconda-${ANACONDA}_QGIS-${QGIS}_JAVA-${JAVA}_SUDO-${SUDO}"
     shm_size: '1gb'
     security_opt:
       - seccomp:unconfined #optional
diff --git a/docker/kasm/Dockerfile b/docker/kasm/Dockerfile
index befc64f..51cc486 100644
--- a/docker/kasm/Dockerfile
+++ b/docker/kasm/Dockerfile
@@ -4,6 +4,7 @@ ENV STARTUPDIR /custom-cont-init.d
 
 ARG QGIS
 ARG ANACONDA
+ARG JAVA
 ARG ANACONDA_VERS=Anaconda3-2024.02-1
 
 RUN apt-get update && \
@@ -35,6 +36,11 @@ RUN if [ "$QGIS" = true ] ; then \
     apt-get -y install qgis qgis-plugin-grass; \
     fi
 
+RUN if [ ! -z "$JAVA" ] ; then \
+    apt-get update; \
+    apt-get -y install $JAVA-jdk $JAVA-jre; \
+    fi
+
 COPY custom_startup.sh $STARTUPDIR/custom_startup.sh
 COPY change_password.sh /
 COPY lecture /etc/sudoers.lecture
-- 
GitLab