Publish Embedded GlassFish Docker Image to GitHub #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Embedded GlassFish Docker Image to GitHub | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| gfVersion: | |
| description: 'The value of the glassfish.version property, used also to build the image.' | |
| required: true | |
| default: '8.0.0' | |
| basicImage: | |
| description: 'The basic docker image' | |
| required: true | |
| default: 'eclipse-temurin:21-jdk' | |
| env: | |
| # Use docker.io for Docker Hub if empty | |
| REGISTRY: ghcr.io | |
| # github.repository as <account>/<repo> | |
| IMAGE_ID: "ghcr.io/${{ github.repository_owner }}/embedded-glassfish" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| # This is used to complete the identity challenge | |
| # with sigstore/fulcio when running outside of PRs. | |
| id-token: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Maven Configure | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: docker-container | |
| platforms: linux/amd64,linux/arm64 | |
| - name: Build | |
| run: mvn clean prepare-package -Dglassfish.version=${{ github.event.inputs.gfVersion }} -Dgf.docker.baseImage=${{ github.event.inputs.basicImage }} | |
| - name: Log in to registry | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Additional Info | |
| run: | | |
| mvn -v | |
| uname -a | |
| docker buildx ls | |
| docker buildx imagetools inspect ${{ env.IMAGE_ID }}:latest || echo "No image ${{ env.IMAGE_ID }}:latest exists" | |
| - name: Build and Deploy | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: images/embedded/${{ github.event.inputs.gfVersion }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ env.IMAGE_ID }}:${{ github.event.inputs.gfVersion }},${{ env.IMAGE_ID }}:latest | |