Skip to content

Publish Docker image #79

Publish Docker image

Publish Docker image #79

Workflow file for this run

name: Publish Docker image
on:
schedule:
- cron: '0 0 * * 6'
workflow_dispatch:
# push:
# branches:
# - main
# - release/*
env:
MAVEN_VERSION: 3.9.9
MVND_VERSION: 1.0.2
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
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
MANDREL_IMAGE=${{ env.MANDREL_FULL_IMAGE }}
MAVEN_VERSION=${{ env.MAVEN_VERSION }}
MVND_VERSION=${{ env.MVND_VERSION }}
- name: Image digest
run: |
echo "Image digest: ${{ steps.docker_build.outputs.digest }}"