Skip to content
Open
Show file tree
Hide file tree
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
42 changes: 29 additions & 13 deletions .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -1258,10 +1262,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
Expand All @@ -1276,7 +1283,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
Expand All @@ -1289,19 +1296,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 }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- 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
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ./
Expand Down Expand Up @@ -42,7 +43,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 \
Expand All @@ -54,7 +55,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 \
Expand Down
Loading