Docker Publish to GitHub #28
Workflow file for this run
This file contains 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: Docker Publish to GitHub | |
on: | |
workflow_dispatch: | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_ID: "ghcr.io/${{ github.repository_owner }}/glassfish" | |
IMAGE_VERSION: 7.0.16 | |
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@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: docker-container | |
platforms: linux/amd64,linux/arm64 | |
- name: Maven Configure | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Build AMD64 | |
run: mvn clean package -Dglassfish.version=$IMAGE_VERSION -Ddocker.platforms=linux/amd64 && docker image tag glassfish:$IMAGE_VERSION $IMAGE_ID:$IMAGE_VERSION && docker image tag glassfish:$IMAGE_VERSION $IMAGE_ID:latest && docker push $IMAGE_ID:$IMAGE_VERSION && docker push $IMAGE_ID:latest | |
- name: Build ARM64 | |
run: mvn clean package -Dglassfish.version=$IMAGE_VERSION -Ddocker.platforms=linux/arm64 && docker image tag glassfish:$IMAGE_VERSION $IMAGE_ID:$IMAGE_VERSION && docker image tag glassfish:$IMAGE_VERSION $IMAGE_ID:latest && docker push $IMAGE_ID:$IMAGE_VERSION && docker push $IMAGE_ID:latest | |
- name: Inspect | |
run: | | |
mvn -v | |
uname -a | |
docker buildx ls | |
docker images | sort | |
docker inspect $IMAGE_ID:latest | grep Architecture |