feat: add PR Docker image builds for x86_64 (#1810)

* Initial plan

* feat: add PR docker build workflow

Add a new workflow that builds and pushes Docker images for pull requests:
- Runs independently without waiting for tests
- Builds only for linux/amd64 platform
- Pushes only to GHCR (not Docker Hub)
- Tags images with pr-<number> format

Co-authored-by: kolaente <13721712+kolaente@users.noreply.github.com>

* feat: add SHA tag to PR Docker images

Add type=sha,format=long to docker tags for PR images.
This will tag images with both pr-<number> and sha-<commit_hash>.

Co-authored-by: kolaente <13721712+kolaente@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kolaente <13721712+kolaente@users.noreply.github.com>
This commit is contained in:
Copilot
2025-11-12 23:31:25 +00:00
committed by GitHub
parent 409edb82c6
commit cf8ad52a27

47
.github/workflows/pr-docker.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: PR Docker Build
on:
pull_request:
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Git describe
id: ghd
uses: proudust/gh-describe@v2
- name: Login to GHCR
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
with:
version: latest
- name: Docker meta
id: meta
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5
with:
images: ghcr.io/go-vikunja/vikunja
tags: |
type=ref,event=pr
type=sha,format=long
- name: Build and push PR image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
RELEASE_VERSION=${{ steps.ghd.outputs.describe }}