Skip to content

.github/workflows/docker-publish.yml #385

.github/workflows/docker-publish.yml

.github/workflows/docker-publish.yml #385

on:
workflow_call:
workflow_dispatch:
pull_request:
branches: [ main, dev ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
init:
uses: ./.github/workflows/init.yml
docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: [ init ]
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Log in to the Container registry
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
- name: Build and push
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
with:
context: ./src
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: >
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.init.outputs.product-version }},
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.init.outputs.product-version-major }},
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
build-args: |
PACKAGE_VERSION=${{ needs.init.outputs.product-version }}