Publish Docker image #59
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: Publish Docker image | |
on: | |
schedule: | |
- cron: '0 0 * * 6' | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main | |
# - release/* | |
env: | |
MAVEN_BINARY_URL: https://dlcdn.apache.org/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz | |
jobs: | |
push_to_registry: | |
name: Push Docker image to Docker Hub & GHCR | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
quarkus-mandrel_image: [quay.io/quarkus/ubi-quarkus-mandrel-builder-image] | |
quarkus-mandrel_version: [jdk-17, jdk-21] | |
env: | |
MANDREL_FULL_IMAGE: ${{ matrix.quarkus-mandrel_image }}:${{ matrix.quarkus-mandrel_version }} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Inspect builder | |
run: | | |
echo "Name: ${{ steps.buildx.outputs.name }}" | |
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" | |
echo "Status: ${{ steps.buildx.outputs.status }}" | |
echo "Flags: ${{ steps.buildx.outputs.flags }}" | |
echo "Platforms: ${{ steps.buildx.outputs.platforms }}" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} | |
- name: Login to the Github Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to My Gitea Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.GITEA_SERVER }} | |
username: ${{ secrets.GITEA_USERNAME }} | |
password: ${{ secrets.GITEA_ACCESS_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
docker.io/${{ github.repository }} | |
ghcr.io/${{ github.repository }} | |
${{ secrets.GITEA_SERVER }}/${{ secrets.GITEA_REPOSITORY }} | |
tags: | | |
type=raw,value=${{ matrix.quarkus-mandrel_version }} | |
- name: Build and push Docker image | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
MANDREL_IMAGE=${{ env.MANDREL_FULL_IMAGE }} | |
MAVEN_BINARY_URL=${{ env.MAVEN_BINARY_URL }} | |
- name: Image digest | |
run: | | |
echo "Image digest: ${{ steps.docker_build.outputs.digest }}" |