Skip to content

Commit

Permalink
Add Temurin fallback
Browse files Browse the repository at this point in the history
Install Temurin when Debian does not have an intallation package in its repositories for an OpenJDK version.

Signed-off-by: Wouter Born <[email protected]>
  • Loading branch information
wborn committed Dec 16, 2024
1 parent 545e0ec commit d3f8ef3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ RUN apk update --no-cache && \
rm -rf /var/cache/apk/*

# Limit JDK crypto policy by default to comply with local laws which may prohibit use of unlimited strength cryptography
RUN JAVA_HOME=$(find /usr/lib/jvm -maxdepth 1 -name "*jdk*" -type d) && \
RUN JAVA_HOME=$(find /usr/lib/jvm -mindepth 1 -maxdepth 1 -type d) && \
sed -i 's/^crypto.policy=unlimited/crypto.policy=limited/' "${JAVA_HOME}/conf/security/java.security"

# Install openHAB
Expand Down
2 changes: 1 addition & 1 deletion alpine/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interactive=$(if test -t 0; then echo true; else echo false; fi)
set -eux -o pipefail ${EXTRA_SHELL_OPTS-}
IFS=$'\n\t'

export JAVA_HOME=$(find /usr/lib/jvm -maxdepth 1 -name "*jdk*" -type d)
export JAVA_HOME=$(find /usr/lib/jvm -mindepth 1 -maxdepth 1 -type d)

# Configure Java unlimited strength cryptography
if [ "${CRYPTO_POLICY}" = "unlimited" ]; then
Expand Down
12 changes: 10 additions & 2 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install basepackages. Versions are "pinned" by using a pinned base image.
# hadolint ignore=DL3008
RUN apt-get update && \

Check failure on line 44 in debian/Dockerfile

View workflow job for this annotation

GitHub Actions / latest-debian

SC2086 info: Double quote to prevent globbing and word splitting.

Check failure on line 44 in debian/Dockerfile

View workflow job for this annotation

GitHub Actions / snapshot-debian

SC2086 info: Double quote to prevent globbing and word splitting.
openjdk_package="openjdk-${JAVA_VERSION}-jre-headless" && \
apt-get install --no-install-recommends -y --dry-run "$openjdk_package" >/dev/null || openjdk_package="temurin-${JAVA_VERSION}-jre" && \
if [ $(echo "$openjdk_package" | grep -E '^temurin-.+$') ]; then \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y wget ca-certificates && \
wget -nv -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /usr/share/keyrings/adoptium.asc && \
echo "deb [signed-by=/usr/share/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list && \
apt-get update; \
fi && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
arping \
ca-certificates \
Expand All @@ -53,7 +61,7 @@ RUN apt-get update && \
locales \
locales-all \
netbase \
openjdk-${JAVA_VERSION}-jre-headless \
$openjdk_package \
procps \
tini \
unzip \
Expand All @@ -66,7 +74,7 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Limit JDK crypto policy by default to comply with local laws which may prohibit use of unlimited strength cryptography
RUN JAVA_HOME=$(find /usr/lib/jvm -maxdepth 1 -name "*jdk*" -type d) && \
RUN JAVA_HOME=$(find /usr/lib/jvm -mindepth 1 -maxdepth 1 -type d) && \
sed -i 's/^crypto.policy=unlimited/crypto.policy=limited/' "${JAVA_HOME}/conf/security/java.security"

# Install openHAB
Expand Down
2 changes: 1 addition & 1 deletion debian/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interactive=$(if test -t 0; then echo true; else echo false; fi)
set -eux -o pipefail ${EXTRA_SHELL_OPTS-}
IFS=$'\n\t'

export JAVA_HOME=$(find /usr/lib/jvm -maxdepth 1 -name "*jdk*" -type d)
export JAVA_HOME=$(find /usr/lib/jvm -mindepth 1 -maxdepth 1 -type d)

# Configure Java unlimited strength cryptography
if [ "${CRYPTO_POLICY}" = "unlimited" ]; then
Expand Down

0 comments on commit d3f8ef3

Please sign in to comment.