feat: Optimize Docker PR builds for speed

- Only trigger PR builds when Docker-related files change
- Skip Docker Hub login/push for PR builds (build-only validation)
- Use single platform (amd64) for PR builds vs multi-platform for releases
- Skip claudecode build entirely for PRs
- Keep aggressive GitHub Actions caching for faster rebuilds
- Add path filtering to prevent unnecessary Docker builds
This commit is contained in:
Jonathan Flatt
2025-05-23 01:18:08 +00:00
committed by Cheffromspace
parent a96d4969ed
commit 4c5fb59251

View File

@@ -11,6 +11,12 @@ on:
branches:
- main
- master
paths:
- 'Dockerfile*'
- 'package*.json'
- '.github/workflows/docker-publish.yml'
- 'src/**'
- 'scripts/**'
env:
DOCKER_HUB_USERNAME: cheffromspace
@@ -52,8 +58,8 @@ jobs:
type=semver,pattern={{major}}
# Latest tag for semantic version tags
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
# SHA for branch builds only
type=sha,prefix={{branch}}-,enable=${{ github.event_name == 'push' && github.ref_type == 'branch' }}
# SHA for branch builds (push only)
type=sha,prefix={{branch}}-,enable=${{ github.event_name != 'pull_request' }}
# For PR builds, use pr-NUMBER
type=ref,event=pr
@@ -61,7 +67,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}