From 4c8e2e96a3f6e14ef13aa159dacc0131068f0818 Mon Sep 17 00:00:00 2001 From: Jeff Mesnil Date: Thu, 3 Nov 2022 10:06:31 +0100 Subject: [PATCH] Build images using a GitHub action Build JDK 11, 17 & 19 images. Apply the lates tag to 17 (latest LTS JDK) using the GitHub action Signed-off-by: Jeff Mesnil --- .github/workflows/publish-release.yml | 43 ++++++++++++++++++++------- Dockerfile | 2 ++ README.md | 31 ++++++++++++++++++- 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3150ffa..5be9e38 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,37 +1,58 @@ -name: publish-release +name: Build and push WildFly Docker images + +# This action requires 4 secrets: +# secrets.REGISTRY - the container registry (e.g. quay.io) +# secrets.IMAGE - the namespaced name of the image (e.g. wildfly/wildfly) +# secrets.REGISTRY_USER - the user name to authentication before pushing the image +# secrets.REGISTRY_PASSWORD - the user password to authentication before pushing the image on: push: tags: - - "*.Final*" + - "*" + jobs: image: + strategy: + matrix: + jdk-version: [11, 17, 19] + env: + # Put the "latest" tag on this JDK version + JDK_VERSION_FOR_LATEST: 17 environment: quay.io runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Docker meta id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v4.1.1 with: images: ${{ secrets.REGISTRY }}/${{ secrets.IMAGE }} - tags: type=ref,event=tag + flavor: | + latest=false + tags: | + type=ref,event=tag,suffix=-jdk${{ matrix.jdk-version }} + type=raw,value=latest,suffix=-jdk${{ matrix.jdk-version }} + type=raw,value=latest,enable=${{ matrix.jdk-version == env.JDK_VERSION_FOR_LATEST }} + labels: | + org.opencontainers.image.jdk-version=${{ matrix.jdk-version }} - name: Set up QEMU - uses: docker/setup-qemu-action@v1.2.0 + uses: docker/setup-qemu-action@v2.1.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2.2.1 - name: Docker Login to Quay.io - uses: docker/login-action@v1 + uses: docker/login-action@v2.1.0 with: registry: ${{ secrets.REGISTRY }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Build and push + - name: Build and push JDK images id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3.2.0 with: push: true platforms: linux/amd64,linux/arm64 + build-args: jdk=${{ matrix.jdk-version }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }},latest + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e22af14..d8b1728 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ ARG jdk=11 FROM eclipse-temurin:${jdk}-centos7 +LABEL org.opencontainers.image.source=https://github.com/jboss-dockerfiles/wildfly org.opencontainers.image.title=wildfly org.opencontainers.imag.url=https://github.com/jboss-dockerfiles/wildfly org.opencontainers.image.vendor=WildFly + WORKDIR /opt/jboss RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss && \ diff --git a/README.md b/README.md index 86eadd8..917c723 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,39 @@ This is an example Dockerfile with [WildFly application server](http://wildfly.o **NOTE** Official builds for this image are now published to [https://quay.io/wildfly/wildfly](https://quay.io/wildfly/wildfly). -Previous repository at [https://hub.docker.com/r/jboss/wildfly](https://hub.docker.com/r/jboss/wildfly) is no longer updated with new images +Previous repository at [https://hub.docker.com/r/jboss/wildfly](https://hub.docker.com/r/jboss/wildfly) is no longer updated with new images. --- +## WildFly Images + +WildFly publishes images to run the application server with different JDK versions. +The tag of the image identifies the version of WildFly as well as the JDK version in the images. + +For each release of WildFly (e.g. `27.0.0.Final`), there are fixed tags for each supported JDK version: + +* `quay.io/wildfly/wildfly:27.0.0.Final-jdk11` +* `quay.io/wildfly/wildfly:27.0.0.Final-jdk17` + +There are also floating tags available to pull the _latest release of WildFly on the various JDK_: + +* `quay.io/wildfly/wildfly:latest-jdk11` +* `quay.io/wildfly/wildfly:latest-jdk17` + +Finally, there is the `latest` tag that pull the _latest release of WildFly on the latest LTS JDK version_: + +* `quay.io/wildfly/wildfly:latest` + +--- +**NOTE** + +_This floating tag may correspond to a different JDK version in future releases of WildFly images._ + +Instead of using the `latest` tag, we recommend to use the floating tag with the JDK version mention to guarantee the use of the same JDK version across WildFly releases (e.g. `latest-jdk17`). + +--- + + ## Usage To boot in standalone mode