From 28c2bb4275768d8ffacafb148e6e5c808fb6eb55 Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 18:55:50 +0100 Subject: [PATCH 1/8] Enable Docker build and push workflow --- .github/workflows/docker-publish.yml | 112 +++++++++++++-------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 892adea..79a6dff 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,56 +1,56 @@ -# name: Build and Push Docker Image -# -# on: -# push: -# tags: ['v*'] -# pull_request: -# branches: [main] -# -# env: -# REGISTRY: ghcr.io -# IMAGE_NAME: ${{ github.repository }} -# -# jobs: -# build-and-push: -# runs-on: ubuntu-latest -# permissions: -# contents: read -# packages: write -# -# steps: -# - name: Checkout repository -# uses: actions/checkout@v6.0.2 -# -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v3.12.0 -# -# - name: Log in to Container Registry -# if: github.event_name != 'pull_request' -# uses: docker/login-action@v3.6.0 -# with: -# registry: ${{ env.REGISTRY }} -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} -# -# - name: Extract metadata (tags, labels) -# id: meta -# uses: docker/metadata-action@v5.10.0 -# with: -# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} -# tags: | -# type=ref,event=branch -# type=ref,event=pr -# type=semver,pattern={{version}} -# type=semver,pattern={{major}}.{{minor}} -# type=sha,prefix= -# -# - name: Build and push Docker image -# uses: docker/build-push-action@v6.18.0 -# with: -# context: . -# push: ${{ github.event_name != 'pull_request' }} -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} -# cache-from: type=gha -# cache-to: type=gha,mode=max -# platforms: linux/amd64,linux/arm64 +name: Build and Push Docker Image + +on: + push: + tags: ['v*'] + pull_request: + branches: [main] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=sha,prefix= + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + platforms: linux/amd64,linux/arm64 From affd97d44a7d186780505fb59866ce3db82e2f6b Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 18:56:58 +0100 Subject: [PATCH 2/8] Add branch triggers for Docker workflow --- .github/workflows/docker-publish.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 79a6dff..5e76f64 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,6 +2,9 @@ name: Build and Push Docker Image on: push: + branches: + - main + - add-docker-workflow tags: ['v*'] pull_request: branches: [main] From 8ecbed7291e4bd3ccfe19c96592ab011919bed5b Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 19:04:56 +0100 Subject: [PATCH 3/8] Update Docker image tagging strategy --- .github/workflows/docker-publish.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 5e76f64..af339ee 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -41,11 +41,9 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | - type=ref,event=branch - type=ref,event=pr + type=raw,value=latest,enable={{is_default_branch}} + type=sha,prefix={{branch}}- type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=sha,prefix= - name: Build and push Docker image uses: docker/build-push-action@v6 From cd6105d5b4e0863687c1a92e73778a6cc7197469 Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 19:05:56 +0100 Subject: [PATCH 4/8] Update to latest action versions and improve SHA tagging --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index af339ee..f84c4c4 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -42,7 +42,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest,enable={{is_default_branch}} - type=sha,prefix={{branch}}- + type=sha,prefix={{branch}}-,format=short type=semver,pattern={{version}} - name: Build and push Docker image From 768778c9346c7a918bac37324dfa04780a98d629 Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 19:08:09 +0100 Subject: [PATCH 5/8] Update to actual latest action versions from 2026 --- .github/workflows/docker-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f84c4c4..612f5e6 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -22,14 +22,14 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Container Registry if: github.event_name != 'pull_request' - uses: docker/login-action@v3 + uses: docker/login-action@v3.6.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -37,7 +37,7 @@ jobs: - name: Extract metadata (tags, labels) id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@v5.7.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | From 66d6b568792d233342067aada8e41672491c2fa4 Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 19:10:36 +0100 Subject: [PATCH 6/8] Add check to skip push if image already exists --- .github/workflows/docker-publish.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 612f5e6..be0f2ba 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -45,7 +45,30 @@ jobs: type=sha,prefix={{branch}}-,format=short type=semver,pattern={{version}} + - name: Check if image exists + id: check + if: github.event_name != 'pull_request' + continue-on-error: true + run: | + TAGS="${{ steps.meta.outputs.tags }}" + IMAGE_EXISTS=false + + for TAG in $TAGS; do + echo "Checking if image exists: $TAG" + if docker manifest inspect $TAG > /dev/null 2>&1; then + echo "Image already exists: $TAG" + IMAGE_EXISTS=true + else + echo "Image does not exist: $TAG" + IMAGE_EXISTS=false + break + fi + done + + echo "should_push=$([[ "$IMAGE_EXISTS" == "false" ]] && echo "true" || echo "false")" >> $GITHUB_OUTPUT + - name: Build and push Docker image + if: github.event_name == 'pull_request' || steps.check.outputs.should_push == 'true' uses: docker/build-push-action@v6 with: context: . @@ -55,3 +78,8 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 + + - name: Image push skipped + if: github.event_name != 'pull_request' && steps.check.outputs.should_push != 'true' + run: | + echo "All image tags already exist in registry. Skipping build and push." From e4a0a9ee50b93ff44e252c5d266a08bd1c4acd8f Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 19:30:43 +0100 Subject: [PATCH 7/8] Simplify Docker workflow to manual dispatch with custom tag --- .github/workflows/docker-publish.yml | 52 ++++------------------------ 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index be0f2ba..f4b8bed 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,11 +1,12 @@ name: Build and Push Docker Image on: - push: - branches: - - main - - add-docker-workflow - tags: ['v*'] + workflow_dispatch: + inputs: + tag: + description: 'Docker image tag' + required: true + type: string pull_request: branches: [main] @@ -35,51 +36,12 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) - id: meta - uses: docker/metadata-action@v5.7.0 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=sha,prefix={{branch}}-,format=short - type=semver,pattern={{version}} - - - name: Check if image exists - id: check - if: github.event_name != 'pull_request' - continue-on-error: true - run: | - TAGS="${{ steps.meta.outputs.tags }}" - IMAGE_EXISTS=false - - for TAG in $TAGS; do - echo "Checking if image exists: $TAG" - if docker manifest inspect $TAG > /dev/null 2>&1; then - echo "Image already exists: $TAG" - IMAGE_EXISTS=true - else - echo "Image does not exist: $TAG" - IMAGE_EXISTS=false - break - fi - done - - echo "should_push=$([[ "$IMAGE_EXISTS" == "false" ]] && echo "true" || echo "false")" >> $GITHUB_OUTPUT - - name: Build and push Docker image - if: github.event_name == 'pull_request' || steps.check.outputs.should_push == 'true' uses: docker/build-push-action@v6 with: context: . push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }} cache-from: type=gha cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 - - - name: Image push skipped - if: github.event_name != 'pull_request' && steps.check.outputs.should_push != 'true' - run: | - echo "All image tags already exist in registry. Skipping build and push." From b7fd5bd33d19581381869b01d20e6a177bce796b Mon Sep 17 00:00:00 2001 From: serversidehannes Date: Wed, 14 Jan 2026 19:33:15 +0100 Subject: [PATCH 8/8] Remove PR trigger from Docker workflow --- .github/workflows/docker-publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index f4b8bed..9a12081 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,8 +7,6 @@ on: description: 'Docker image tag' required: true type: string - pull_request: - branches: [main] env: REGISTRY: ghcr.io