From b5154abfd1986e8eb067435041ed2f9336677339 Mon Sep 17 00:00:00 2001 From: Dan Caseley Date: Sat, 4 Jul 2026 16:49:35 +0100 Subject: [PATCH] OF-3326: Make Java 21 the default container runtime, add Java 25 variant --- .../continuous-integration-workflow.yml | 42 +++++++++++++------ Dockerfile | 9 ++-- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/.github/workflows/continuous-integration-workflow.yml b/.github/workflows/continuous-integration-workflow.yml index 26bb13ac66..a7844a5968 100644 --- a/.github/workflows/continuous-integration-workflow.yml +++ b/.github/workflows/continuous-integration-workflow.yml @@ -76,9 +76,12 @@ jobs: build-docker: - name: Build Docker image + name: Build Docker image (Java ${{ matrix.java }}) runs-on: ubuntu-latest needs: build + strategy: + matrix: + java: [21, 25] steps: - name: Checkout repository @@ -96,17 +99,18 @@ jobs: with: context: . load: true - tags: ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} + build-args: JAVA_VERSION=${{ matrix.java }} + tags: ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} cache-from: type=gha,scope=openfire-${{ steps.cache-hash.outputs.hash }} cache-to: type=gha,mode=max,scope=openfire-${{ steps.cache-hash.outputs.hash }} - name: Save Docker image to tar archive - run: docker save ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} | gzip > openfire-docker-image.tar.gz + run: docker save ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} | gzip > openfire-docker-image.tar.gz - name: Upload Docker image archive uses: actions/upload-artifact@v7 with: - name: Openfire Docker Image + name: Openfire Docker Image Java ${{ matrix.java }} path: openfire-docker-image.tar.gz retention-days: 1 @@ -121,13 +125,13 @@ jobs: - name: Download Docker image archive uses: actions/download-artifact@v8 with: - name: Openfire Docker Image + name: Openfire Docker Image Java 21 path: . - name: Load Docker image run: | docker load < openfire-docker-image.tar.gz - docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} openfire:latest + docker tag ${{ env.IMAGE_NAME }}:ci-java21-${{ github.sha }} openfire:latest - name: Checkout Integration Tests uses: actions/checkout@v7 @@ -1244,10 +1248,13 @@ jobs: IGNITE_REALTIME_MAVEN_PASSWORD: ${{ secrets.IGNITE_REALTIME_MAVEN_PASSWORD }} publish-docker: - name: Publish to GitHub's Docker registry + name: Publish to GitHub's Docker registry (Java ${{ matrix.java }}) runs-on: ubuntu-latest 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] if: ${{ github.repository == 'igniterealtime/Openfire' && github.event_name == 'push' && needs.check_branch.outputs.is_publishable_branch == 'true' }} + strategy: + matrix: + java: [21, 25] permissions: contents: read @@ -1262,7 +1269,7 @@ jobs: - name: Download Docker image archive uses: actions/download-artifact@v8 with: - name: Openfire Docker Image + name: Openfire Docker Image Java ${{ matrix.java }} path: . - name: Load Docker image @@ -1275,19 +1282,28 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for image registry + - name: Extract metadata (plain tags, default Java version only) id: meta + if: ${{ matrix.java == 21 }} + uses: docker/metadata-action@v6 + with: + images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }} + + - name: Extract metadata (versioned tags) + id: meta-versioned uses: docker/metadata-action@v6 with: images: ${{ env.REGISTRY }}/igniterealtime/${{ env.IMAGE_NAME }} + flavor: suffix=-java${{ matrix.java }} - - name: Retag and push final image + - name: Tag and push image id: push run: | - FIRST_TAG=$(echo "${{ steps.meta.outputs.tags }}" | head -n1) - docker tag ${{ env.IMAGE_NAME }}:ci-${{ github.sha }} $FIRST_TAG + ALL_TAGS=$(printf '%s\n' "${{ steps.meta.outputs.tags }}" "${{ steps.meta-versioned.outputs.tags }}" | grep -v '^$') + FIRST_TAG=$(echo "$ALL_TAGS" | head -n1) + docker tag ${{ env.IMAGE_NAME }}:ci-java${{ matrix.java }}-${{ github.sha }} $FIRST_TAG DIGEST=$(docker push $FIRST_TAG | grep -oP 'digest: \K\S+') - for tag in $(echo "${{ steps.meta.outputs.tags }}" | tail -n +2); do + for tag in $(echo "$ALL_TAGS" | tail -n +2); do docker tag $FIRST_TAG $tag docker push $tag done diff --git a/Dockerfile b/Dockerfile index c1168c303e..2b6c536a92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ # This stage extracts all the pom.xml files. # It'll get rebuilt with any source change, but that's OK. # It doesn't matter what image we're using, really, so we may as well use one of the same images as elsewhere. -FROM eclipse-temurin:17-jre AS poms +ARG JAVA_VERSION=21 +FROM eclipse-temurin:${JAVA_VERSION}-jre AS poms WORKDIR /usr/src COPY . . # 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 RUN find . -type d -empty -delete # Now we build: -FROM eclipse-temurin:17 AS build +FROM eclipse-temurin:${JAVA_VERSION} AS build WORKDIR /tmp/ WORKDIR /usr/src COPY mvnw ./ @@ -41,7 +42,7 @@ RUN sed -i 's/\r//g' /usr/src/distribution/target/distribution-base/bin/openfire # Might as well create the user in a different stage if only to eliminate # the ugly && chaining and increase parallelization -FROM eclipse-temurin:17-jre AS skeleton-runtime +FROM eclipse-temurin:${JAVA_VERSION}-jre AS skeleton-runtime ENV OPENFIRE_USER=openfire \ OPENFIRE_DIR=/usr/local/openfire \ @@ -53,7 +54,7 @@ RUN apt-get install -yyq adduser RUN adduser --disabled-password --quiet --system --home $OPENFIRE_DATA_DIR --gecos "Openfire XMPP server" --group $OPENFIRE_USER # Final stage, build the runtime container: -FROM eclipse-temurin:17-jre AS runtime +FROM eclipse-temurin:${JAVA_VERSION}-jre AS runtime ENV OPENFIRE_USER=openfire \ OPENFIRE_DIR=/usr/local/openfire \