Skip to content

Commit 453deca

Browse files
committed
OF-3326: Make Java 21 the default container runtime, add Java 25 variant
1 parent 19b43e0 commit 453deca

2 files changed

Lines changed: 34 additions & 17 deletions

File tree

.github/workflows/continuous-integration-workflow.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,12 @@ jobs:
7676

7777
build-docker:
7878

79-
name: Build Docker image
79+
name: Build Docker image (Java ${{ matrix.java }})
8080
runs-on: ubuntu-latest
8181
needs: build
82+
strategy:
83+
matrix:
84+
java: [21, 25]
8285

8386
steps:
8487
- name: Checkout repository
@@ -96,17 +99,18 @@ jobs:
9699
with:
97100
context: .
98101
load: true
99-
tags: ${{ env.IMAGE_NAME }}:ci-${{ github.sha }}
102+
build-args: JAVA_VERSION=${{ matrix.java }}
103+
tags: ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }}
100104
cache-from: type=gha,scope=openfire-${{ steps.cache-hash.outputs.hash }}
101105
cache-to: type=gha,mode=max,scope=openfire-${{ steps.cache-hash.outputs.hash }}
102106

103107
- name: Save Docker image to tar archive
104-
run: docker save ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} | gzip > openfire-docker-image.tar.gz
108+
run: docker save ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} | gzip > openfire-docker-image.tar.gz
105109

106110
- name: Upload Docker image archive
107111
uses: actions/upload-artifact@v7
108112
with:
109-
name: Openfire Docker Image
113+
name: Openfire Docker Image Java ${{ matrix.java }}
110114
path: openfire-docker-image.tar.gz
111115
retention-days: 1
112116

@@ -121,13 +125,13 @@ jobs:
121125
- name: Download Docker image archive
122126
uses: actions/download-artifact@v8
123127
with:
124-
name: Openfire Docker Image
128+
name: Openfire Docker Image Java 21
125129
path: .
126130

127131
- name: Load Docker image
128132
run: |
129133
docker load < openfire-docker-image.tar.gz
130-
docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} openfire:latest
134+
docker tag ${{ env.IMAGE_NAME }}:ci-java21-${{ github.sha }} openfire:latest
131135
132136
- name: Checkout Integration Tests
133137
uses: actions/checkout@v7
@@ -1258,10 +1262,13 @@ jobs:
12581262
IGNITE_REALTIME_MAVEN_PASSWORD: ${{ secrets.IGNITE_REALTIME_MAVEN_PASSWORD }}
12591263

12601264
publish-docker:
1261-
name: Publish to GitHub's Docker registry
1265+
name: Publish to GitHub's Docker registry (Java ${{ matrix.java }})
12621266
runs-on: ubuntu-latest
12631267
needs: [build-docker, aioxmpp, connectivity, integration, xitf, check_branch, hsqldb-install, hsqldb-upgrade, sqlserver-install, sqlserver-upgrade, postgres-install, postgres-upgrade, cockroachdb-install, cockroachdb-upgrade, firebird-install, firebird-upgrade, mysql-install, mysql-upgrade, mariadb-install, mariadb-upgrade, oracle-install, oracle-upgrade]
12641268
if: ${{ github.repository == 'igniterealtime/Openfire' && github.event_name == 'push' && needs.check_branch.outputs.is_publishable_branch == 'true' }}
1269+
strategy:
1270+
matrix:
1271+
java: [21, 25]
12651272

12661273
permissions:
12671274
contents: read
@@ -1276,7 +1283,7 @@ jobs:
12761283
- name: Download Docker image archive
12771284
uses: actions/download-artifact@v8
12781285
with:
1279-
name: Openfire Docker Image
1286+
name: Openfire Docker Image Java ${{ matrix.java }}
12801287
path: .
12811288

12821289
- name: Load Docker image
@@ -1289,19 +1296,28 @@ jobs:
12891296
username: ${{ github.actor }}
12901297
password: ${{ secrets.GITHUB_TOKEN }}
12911298

1292-
- name: Extract metadata (tags, labels) for image registry
1299+
- name: Extract metadata (plain tags, default Java version only)
12931300
id: meta
1301+
if: ${{ matrix.java == 21 }}
1302+
uses: docker/metadata-action@v6
1303+
with:
1304+
images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }}
1305+
1306+
- name: Extract metadata (versioned tags)
1307+
id: meta-versioned
12941308
uses: docker/metadata-action@v6
12951309
with:
12961310
images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }}
1311+
flavor: suffix=-java${{ matrix.java }}
12971312

1298-
- name: Retag and push final image
1313+
- name: Tag and push image
12991314
id: push
13001315
run: |
1301-
FIRST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
1302-
docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} $FIRST_TAG
1316+
ALL_TAGS=$(printf '%s\n' "${{ steps.meta.outputs.tags }}" "${{ steps.meta-versioned.outputs.tags }}" | grep -v '^$')
1317+
FIRST_TAG=$(echo "$ALL_TAGS" | head -n1)
1318+
docker tag ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} $FIRST_TAG
13031319
DIGEST=$(docker push $FIRST_TAG | grep -oP 'digest: \K\S+')
1304-
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tail -n +2); do
1320+
for tag in $(echo "$ALL_TAGS" | tail -n +2); do
13051321
docker tag $FIRST_TAG $tag
13061322
docker push $tag
13071323
done

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# This stage extracts all the pom.xml files.
22
# It'll get rebuilt with any source change, but that's OK.
33
# It doesn't matter what image we're using, really, so we may as well use one of the same images as elsewhere.
4-
FROM eclipse-temurin:17-jre AS poms
4+
ARG JAVA_VERSION=21
5+
FROM eclipse-temurin:${JAVA_VERSION}-jre AS poms
56
WORKDIR /usr/src
67
COPY . .
78
# Wipe any files not called pom.xml or *.jar
@@ -10,7 +11,7 @@ RUN find . -type f -and \! -name pom.xml -and \! -name '*.jar' -delete
1011
RUN find . -type d -empty -delete
1112

1213
# Now we build:
13-
FROM eclipse-temurin:17 AS build
14+
FROM eclipse-temurin:${JAVA_VERSION} AS build
1415
WORKDIR /tmp/
1516
WORKDIR /usr/src
1617
COPY mvnw ./
@@ -42,7 +43,7 @@ RUN sed -i 's/\r//g' /usr/src/distribution/target/distribution-base/bin/openfire
4243

4344
# Might as well create the user in a different stage if only to eliminate
4445
# the ugly && chaining and increase parallelization
45-
FROM eclipse-temurin:17-jre AS skeleton-runtime
46+
FROM eclipse-temurin:${JAVA_VERSION}-jre AS skeleton-runtime
4647

4748
ENV OPENFIRE_USER=openfire \
4849
OPENFIRE_DIR=/usr/local/openfire \
@@ -54,7 +55,7 @@ RUN apt-get install -yyq adduser
5455
RUN adduser --disabled-password --quiet --system --home $OPENFIRE_DATA_DIR --gecos "Openfire XMPP server" --group $OPENFIRE_USER
5556

5657
# Final stage, build the runtime container:
57-
FROM eclipse-temurin:17-jre AS runtime
58+
FROM eclipse-temurin:${JAVA_VERSION}-jre AS runtime
5859

5960
ENV OPENFIRE_USER=openfire \
6061
OPENFIRE_DIR=/usr/local/openfire \

0 commit comments

Comments
 (0)