Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
remove base-devel, remove jdk, add in env var for java version
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Sep 24, 2021
1 parent 89f0259 commit 463d716
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ docker run -d \
--name=<container name> \
-v <path for config files>:/config \
-v /etc/localtime:/etc/localtime:ro \
-e JAVA_VERSION=<8|11|16> \
-e UMASK=<umask for created files> \
-e PUID=<uid for user> \
-e PGID=<gid for user> \
Expand All @@ -40,6 +41,7 @@ docker run -d \
--name=crafty \
-v /apps/docker/crafty:/config \
-v /etc/localtime:/etc/localtime:ro \
-e JAVA_VERSION=16 \
-e UMASK=000 \
-e PUID=0 \
-e PGID=0 \
Expand Down
24 changes: 23 additions & 1 deletion build/root/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fi
####

# define pacman packages
pacman_packages="jdk8-openjdk jre8-openjdk-headless jre11-openjdk-headless base-devel"
pacman_packages="jre8-openjdk-headless jre11-openjdk-headless"

# install compiled packages using pacman
if [[ ! -z "${pacman_packages}" ]]; then
Expand Down Expand Up @@ -133,6 +133,28 @@ rm /tmp/permissions_heredoc
####

cat <<'EOF' > /tmp/envvars_heredoc
export JAVA_VERSION=$(echo "${JAVA_VERSION}" | sed -e 's~^[ \t]*~~;s~[ \t]*$~~')
if [[ ! -z "${JAVA_VERSION}" ]]; then
echo "[info] JAVA_VERSION defined as '${JAVA_VERSION}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[info] JAVA_VERSION not defined,(via -e JAVA_VERSION), defaulting to Java version '16'" | ts '%Y-%m-%d %H:%M:%.S'
export JAVA_VERSION="16"
fi
if [[ "${JAVA_VERSION}" == "8" ]]; then
ln -fs /usr/lib/jvm/java-8-openjdk/jre/bin/java /usr/bin/java
archlinux-java set java-8-openjdk/jre
elif [[ "${JAVA_VERSION}" == "11" ]]; then
ln -fs /usr/lib/jvm/java-11-openjdk/bin/java /usr/bin/java
archlinux-java set java-11-openjdk
elif [[ "${JAVA_VERSION}" == "16" ]]; then
ln -fs /usr/lib/jvm/java-16-openjdk/bin/java /usr/bin/java
archlinux-java set java-16-openjdk
else
echo "[warn] Java version '${JAVA_VERSION}' not installed, defaulting to Java version '16" | ts '%Y-%m-%d %H:%M:%.S'
ln -fs /usr/lib/jvm/java-16-openjdk/bin/java /usr/bin/java
archlinux-java set java-16-openjdk
fi
EOF

# replace env vars placeholder string with contents of file (here doc)
Expand Down

0 comments on commit 463d716

Please sign in to comment.