Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ballerina/ballerina Docker image to JDK 21 #1054

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 39 additions & 4 deletions base/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
# limitations under the License.
# -----------------------------------------------------------------------

FROM alpine:3.17.3
FROM alpine:3.20.3

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

LABEL maintainer="[email protected]"

# Ballerina runtime distribution filename.
Expand All @@ -29,8 +32,41 @@ RUN mkdir -p /ballerina/files \
&& adduser -S -s /bin/bash -g 'ballerina' -G troupe -D ballerina \
&& apk add --upgrade apk-tools \
&& apk upgrade \
&& apk add --update --no-cache bash openjdk17-jre=17.0.11_p9-r0 docker-cli libc6-compat gcompat \
&& unzip /root/${BALLERINA_DIST} -d /ballerina/ > /dev/null 2>&1 \
&& apk add --update --no-cache bash docker-cli libc6-compat gcompat

RUN set -eux; \
ARCH="$(apk --print-arch)"; \
case "${ARCH}" in \
amd64|x86_64) \
ESUM='8da7da49101d45f646272616f20e8b10d57472bbf5961d64ffb07d7ba93c6909'; \
BINARY_URL='https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_x64_alpine-linux_hotspot_21.0.5_11.tar.gz'; \
;; \
aarch64) \
ESUM='f22e32b869dd0e5e3f248646f62bffaa307b360299488ac8764e622923d7e747'; \
BINARY_URL='https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jdk_aarch64_alpine-linux_hotspot_21.0.5_11.tar.gz'; \
;;\
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
esac; \
wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
mkdir -p /opt/java/openjdk; \
tar --extract \
--file /tmp/openjdk.tar.gz \
--directory /opt/java/openjdk \
--strip-components 1 \
--no-same-owner \
; \
rm -rf /tmp/openjdk.tar.gz;

ENV LD_PRELOAD=/lib/libgcompat.so.0

ENV JAVA_HOME=/opt/java/openjdk \
PATH="/opt/java/openjdk/bin:$PATH"

RUN unzip /root/${BALLERINA_DIST} -d /ballerina/ > /dev/null 2>&1 \
&& mv /ballerina/ballerina* /ballerina/runtime \
&& mkdir -p /ballerina/runtime/logs \
&& chown -R ballerina:troupe /ballerina \
Expand All @@ -39,7 +75,6 @@ RUN mkdir -p /ballerina/files \

ENV BALLERINA_HOME /ballerina/runtime
ENV PATH $BALLERINA_HOME/bin:$PATH
ENV JAVA_HOME=/usr/lib/jvm/default-jvm

WORKDIR /home/ballerina
VOLUME /home/ballerina
Expand Down
Loading