Skip to content

Commit

Permalink
add riscv64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
gdams committed Mar 13, 2024
1 parent 83bdda1 commit b21e8cf
Show file tree
Hide file tree
Showing 7 changed files with 229 additions and 6 deletions.
90 changes: 90 additions & 0 deletions 21/jdk/debian/sid-slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# ------------------------------------------------------------------------------
# NOTE: THIS DOCKERFILE IS GENERATED VIA "generate_dockerfiles.py"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
# ------------------------------------------------------------------------------
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM debian:sid-slim

ENV JAVA_HOME /opt/java/openjdk
ENV PATH $JAVA_HOME/bin:$PATH

# Default to UTF-8 file.encoding
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
# java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
fontconfig \
# utilities for keeping Ubuntu and OpenJDK CA certificates in sync
# https://github.com/adoptium/containers/issues/293
ca-certificates p11-kit \
# jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351
# Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory
binutils \
tzdata \
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
locales \
; \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
locale-gen en_US.UTF-8; \
rm -rf /var/lib/apt/lists/*

ENV JAVA_VERSION jdk-21.0.2+13

RUN set -eux; \
ARCH="$(dpkg --print-architecture)"; \
case "${ARCH}" in \
riscv64) \
ESUM='791a37ddb040e1a02bbfc61abfbc7e7321431a28054c9ac59ba1738fd5320b02'; \
BINARY_URL='https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_riscv64_linux_hotspot_21.0.2_13.tar.gz'; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
wget --progress=dot:giga -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
mkdir -p "$JAVA_HOME"; \
tar --extract \
--file /tmp/openjdk.tar.gz \
--directory "$JAVA_HOME" \
--strip-components 1 \
--no-same-owner \
; \
rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/lib/src.zip; \
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
ldconfig; \
# https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
# https://openjdk.java.net/jeps/341
java -Xshare:dump;

RUN set -eux; \
echo "Verifying install ..."; \
fileEncoding="$(echo 'System.out.println(System.getProperty("file.encoding"))' | jshell -s -)"; [ "$fileEncoding" = 'UTF-8' ]; rm -rf ~/.java; \
echo "javac --version"; javac --version; \
echo "java --version"; java --version; \
echo "Complete."
COPY entrypoint.sh /__cacert_entrypoint.sh
ENTRYPOINT ["/__cacert_entrypoint.sh"]

CMD ["jshell"]
83 changes: 83 additions & 0 deletions 21/jre/debian/sid-slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# ------------------------------------------------------------------------------
# NOTE: THIS DOCKERFILE IS GENERATED VIA "generate_dockerfiles.py"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
# ------------------------------------------------------------------------------
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM debian:sid-slim

ENV JAVA_HOME /opt/java/openjdk
ENV PATH $JAVA_HOME/bin:$PATH

# Default to UTF-8 file.encoding
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
# java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
fontconfig \
# utilities for keeping Ubuntu and OpenJDK CA certificates in sync
# https://github.com/adoptium/containers/issues/293
ca-certificates p11-kit \
tzdata \
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
locales \
; \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
locale-gen en_US.UTF-8; \
rm -rf /var/lib/apt/lists/*

ENV JAVA_VERSION jdk-21.0.2+13

RUN set -eux; \
ARCH="$(dpkg --print-architecture)"; \
case "${ARCH}" in \
riscv64) \
ESUM='efdeca282553229aa20d909ab9f5fb14eee52b56067a5598e6c649ef5f99a63d'; \
BINARY_URL='https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jre_riscv64_linux_hotspot_21.0.2_13.tar.gz'; \
;; \
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
wget --progress=dot:giga -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
mkdir -p "$JAVA_HOME"; \
tar --extract \
--file /tmp/openjdk.tar.gz \
--directory "$JAVA_HOME" \
--strip-components 1 \
--no-same-owner \
; \
rm -f /tmp/openjdk.tar.gz ${JAVA_HOME}/lib/src.zip; \
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
ldconfig; \
# https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
# https://openjdk.java.net/jeps/341
java -Xshare:dump;

RUN set -eux; \
echo "Verifying install ..."; \
echo "java --version"; java --version; \
echo "Complete."
COPY entrypoint.sh /__cacert_entrypoint.sh
ENTRYPOINT ["/__cacert_entrypoint.sh"]
6 changes: 6 additions & 0 deletions config/hotspot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ configurations:
deprecated: 20
os: ubuntu

# sid -- Debian x.y Unstable - Not Released
- directory: debian/sid-slim
architectures: [riscv64]
image: debian:sid-slim
os: debian

- directory: centos
architectures: [aarch64, ppc64le, x64]
image: centos:7
Expand Down
43 changes: 43 additions & 0 deletions docker_templates/debian.Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% include 'partials/license.j2' %}

FROM {{ base_image }}

{% include 'partials/nix-env.j2' %}

RUN set -eux; \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget \
# java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
fontconfig \
# utilities for keeping Ubuntu and OpenJDK CA certificates in sync
# https://github.com/adoptium/containers/issues/293
ca-certificates p11-kit \
{% include 'partials/binutils.j2' -%}
tzdata \
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
locales \
; \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
locale-gen en_US.UTF-8; \
rm -rf /var/lib/apt/lists/*

ENV JAVA_VERSION {{ java_version }}

{% include 'partials/multi-arch-install.j2' %} \
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
{% if version|int >= 11 -%}
ldconfig; \
# https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
# https://openjdk.java.net/jeps/341
java -Xshare:dump;
{% else -%}
ldconfig;
{% endif %}
{% include 'partials/version-check.j2' %}
COPY entrypoint.sh /__cacert_entrypoint.sh
ENTRYPOINT ["/__cacert_entrypoint.sh"]
{% include 'partials/jshell.j2' %}
2 changes: 1 addition & 1 deletion docker_templates/partials/arch-variable.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if os == "ubuntu" %}
{%- if os == "ubuntu" or os == "debian" %}
ARCH="$(dpkg --print-architecture)"; \
{%- elif os == "alpine-linux" %}
ARCH="$(apk --print-arch)"; \
Expand Down
7 changes: 3 additions & 4 deletions dockerhub_doc_config_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ all_packages="jdk jre"
# Fetch the latest manifest from the official repo
wget -q -O official-eclipse-temurin https://raw.githubusercontent.com/docker-library/official-images/master/library/eclipse-temurin

oses="alpine ubuntu centos ubi windowsservercore-ltsc2022 nanoserver-ltsc2022 windowsservercore-1809 nanoserver-1809"
oses="alpine ubuntu centos debian ubi windowsservercore-ltsc2022 nanoserver-ltsc2022 windowsservercore-1809 nanoserver-1809"
# The image which is used by default when pulling shared tags on linux e.g 8-jdk
default_linux_image="jammy"

git_repo="https://github.com/adoptium/containers/blob/master"

# Get the latest git commit of the current repo.
# This is assumed to have all the latest dockerfiles already.
gitcommit=$(git log | head -1 | awk '{ print $2 }')
Expand Down Expand Up @@ -70,6 +68,7 @@ function generate_official_image_tags() {

case $os in
"ubuntu") distro=$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
"debian") distro="debian-$(echo $dfdir | awk -F '/' '{ print $4 }' )" ;;
"ubi") distro=$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
"centos") distro="centos7" ;;
"windows") distro=$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
Expand Down Expand Up @@ -184,7 +183,7 @@ function print_official_image_file() {
rm -f ${official_docker_image_file}
print_official_header

official_os_ignore_array=(clefos debian debianslim leap tumbleweed)
official_os_ignore_array=(clefos leap tumbleweed)

# Generate config and doc info only for "supported" official builds.
function generate_official_image_info() {
Expand Down
4 changes: 3 additions & 1 deletion generate_dockerfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def archHelper(arch, os_family):
print("Generating Dockerfiles for", base_image, "-", version)
for image_type in ["jdk", "jre"]:
output_directory = os.path.join(str(version), image_type, directory)
os.makedirs(output_directory, exist_ok=True)

# Fetch latest release for version from Adoptium API
url = f"https://api.adoptium.net/v3/assets/feature_releases/{version}/ga?page=0&image_type={image_type}&os={os_family}&page_size=1&vendor=eclipse"
Expand Down Expand Up @@ -126,6 +125,9 @@ def archHelper(arch, os_family):
# If arch_data is empty, skip updating the dockerfile
if arch_data.__len__() == 0:
continue
else:
# Create the directory if it doesn't exist
os.makedirs(output_directory, exist_ok=True)

# Sort arch_data by key
arch_data = dict(sorted(arch_data.items()))
Expand Down

0 comments on commit b21e8cf

Please sign in to comment.