Skip to content

Commit c53dc32

Browse files
committed
OF-3326: Make Java 21 the default container runtime, add Java 25 variant
1 parent a089b94 commit c53dc32

2 files changed

Lines changed: 36 additions & 19 deletions

File tree

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

Lines changed: 31 additions & 15 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 }}
100-
cache-from: type=gha,scope=openfire-${{ steps.cache-hash.outputs.hash }}
101-
cache-to: type=gha,mode=max,scope=openfire-${{ steps.cache-hash.outputs.hash }}-${{ github.sha }}
102+
build-args: JAVA_VERSION=${{ matrix.java }}
103+
tags: ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }}
104+
cache-from: type=gha,scope=openfire-java${{ matrix.java }}-${{ steps.cache-hash.outputs.hash }}
105+
cache-to: type=gha,mode=max,scope=openfire-java${{ matrix.java }}-${{ steps.cache-hash.outputs.hash }}-${{ github.sha }}
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
@@ -1244,10 +1248,13 @@ jobs:
12441248
IGNITE_REALTIME_MAVEN_PASSWORD: ${{ secrets.IGNITE_REALTIME_MAVEN_PASSWORD }}
12451249

12461250
publish-docker:
1247-
name: Publish to GitHub's Docker registry
1251+
name: Publish to GitHub's Docker registry (Java ${{ matrix.java }})
12481252
runs-on: ubuntu-latest
12491253
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]
12501254
if: ${{ github.repository == 'igniterealtime/Openfire' && github.event_name == 'push' && needs.check_branch.outputs.is_publishable_branch == 'true' }}
1255+
strategy:
1256+
matrix:
1257+
java: [21, 25]
12511258

12521259
permissions:
12531260
contents: read
@@ -1262,7 +1269,7 @@ jobs:
12621269
- name: Download Docker image archive
12631270
uses: actions/download-artifact@v8
12641271
with:
1265-
name: Openfire Docker Image
1272+
name: Openfire Docker Image Java ${{ matrix.java }}
12661273
path: .
12671274

12681275
- name: Load Docker image
@@ -1275,19 +1282,28 @@ jobs:
12751282
username: ${{ github.actor }}
12761283
password: ${{ secrets.GITHUB_TOKEN }}
12771284

1278-
- name: Extract metadata (tags, labels) for image registry
1285+
- name: Extract metadata (plain tags, default Java version only)
12791286
id: meta
1287+
if: ${{ matrix.java == 21 }}
1288+
uses: docker/metadata-action@v6
1289+
with:
1290+
images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }}
1291+
1292+
- name: Extract metadata (versioned tags)
1293+
id: meta-versioned
12801294
uses: docker/metadata-action@v6
12811295
with:
12821296
images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }}
1297+
flavor: suffix=-java${{ matrix.java }}
12831298

1284-
- name: Retag and push final image
1299+
- name: Tag and push image
12851300
id: push
12861301
run: |
1287-
FIRST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1)
1288-
docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} $FIRST_TAG
1302+
ALL_TAGS=$(printf '%s\n' "${{ steps.meta.outputs.tags }}" "${{ steps.meta-versioned.outputs.tags }}" | grep -v '^$')
1303+
FIRST_TAG=$(echo "$ALL_TAGS" | head -n1)
1304+
docker tag ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} $FIRST_TAG
12891305
DIGEST=$(docker push $FIRST_TAG | grep -oP 'digest: \K\S+')
1290-
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tail -n +2); do
1306+
for tag in $(echo "$ALL_TAGS" | tail -n +2); do
12911307
docker tag $FIRST_TAG $tag
12921308
docker push $tag
12931309
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 ./
@@ -41,7 +42,7 @@ RUN sed -i 's/\r//g' /usr/src/distribution/target/distribution-base/bin/openfire
4142

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

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

5556
# Final stage, build the runtime container:
56-
FROM eclipse-temurin:17-jre AS runtime
57+
FROM eclipse-temurin:${JAVA_VERSION}-jre AS runtime
5758

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

0 commit comments

Comments
 (0)