Skip to content

Commit

Permalink
upgrade to java 21 (temurin) and bump debian - ring-fence public key …
Browse files Browse the repository at this point in the history
…to adoptium
  • Loading branch information
andponlin committed Nov 16, 2023
1 parent a4070df commit ae9622e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
29 changes: 14 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,25 @@
# a deployable stage.

# -------------------------------------
# Assemble the build image with the dependencies
# Base image with the Eclipse Temurin repository setup.

FROM debian:12.2-slim as build
FROM debian:12.2-slim as base

RUN apt-get update && \
apt-get -y install wget apt-transport-https gnupg

RUN wget -O - "https://packages.adoptium.net/artifactory/api/gpg/key/public" | apt-key add - && \
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
RUN mkdir /adoptium

RUN wget -O - "https://packages.adoptium.net/artifactory/api/gpg/key/public" | gpg --dearmour | dd of=/adoptium/apt-keyring.gpg
COPY support/deployment/deb-adoptium-sources-template.txt /adoptium/deb-adoptium-sources-template.txt
RUN OS_VERSION_CODENAME="$(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release)" && \
cat /adoptium/deb-adoptium-sources-template.txt | sed -e "s/SUITE/${OS_VERSION_CODENAME}/g" | dd of=/etc/apt/sources.list.d/adoptium.sources

# -------------------------------------
# Assemble the build image with the dependencies

FROM base as build

# the handling here for `ca-certificates-java` is to get around a sequencing
# problem that comes up with GitHub actions.
RUN apt-get update && \
apt-get -y install temurin-21-jdk && \
apt-get -y install wget python3 fontconfig fonts-dejavu-core lsb-release gnupg2 && \
Expand Down Expand Up @@ -75,16 +82,8 @@ RUN ./mvnw clean install
# -------------------------------------
# Create the container that will eventually run HDS

FROM debian:12.2-slim AS runtime

RUN apt-get update && \
apt-get -y install wget apt-transport-https gnupg

RUN wget -O - "https://packages.adoptium.net/artifactory/api/gpg/key/public" | apt-key add - && \
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
FROM base AS runtime

# the handling here for `ca-certificates-java` is to get around a sequencing
# problem that comes up with GitHub actions.
RUN apt-get update && \
apt-get -y install temurin-21-jre && \
apt-get -y install optipng libpng16-16 curl fontconfig fonts-dejavu-core
Expand Down
5 changes: 5 additions & 0 deletions support/deployment/deb-adoptium-sources-template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Types: deb
URIs: https://packages.adoptium.net/artifactory/deb
Suites: SUITE
Components: main
Signed-By: /adoptium/apt-keyring.gpg

3 comments on commit ae9622e

@korli
Copy link

@korli korli commented on ae9622e Jun 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andponlin I experienced that, with JDK21, when the environment variable LANG is missing, it means internally it defaults to ASCII for some tasks like reading environment variables. file.encoding=UTF-8 doesn't help.
I had to declare "ENV LANG C.UTF-8", so it behaves like JDK17. Might be a good idea to do the same in this Dockerfile (it's a default as seen here: https://github.com/adoptium/containers/blob/main/21/jdk/ubuntu/jammy/Dockerfile)

@andponlin
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @korli ; Thanks for that tip. I've just updated that on master and so it should be good on the next release. 👍

@korli
Copy link

@korli korli commented on ae9622e Jun 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andponlin you might need to install the locales package too

Please sign in to comment.