Docker Publish to GitHub #24
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 | |
# Add support for more platforms with QEMU (optional) | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Maven Configure | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Maven Build for 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 | |
- name: Maven Build for 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 | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Docker Push | |
run: | | |
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 |