Skip to content

Publish Docker image to ghcr.io on master push#4

Merged
fffaraz merged 2 commits intomasterfrom
copilot/update-docker-workflow-publish
Mar 20, 2026
Merged

Publish Docker image to ghcr.io on master push#4
fffaraz merged 2 commits intomasterfrom
copilot/update-docker-workflow-publish

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

The Docker workflow only built the image locally and never published it. Updated to push to GitHub Container Registry after successful builds on master.

  • Replace manual docker build with docker/build-push-action@v6
  • Authenticate to ghcr.io via docker/login-action@v3 using GITHUB_TOKEN (no external secrets needed)
  • Tag images with latest (on default branch) and short SHA via docker/metadata-action@v5
  • Push only on push events to master; PR builds remain build-only
  • Add packages: write permission to enable ghcr.io push

⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Update Docker workflow to publish image after successful master build Publish Docker image to ghcr.io on master push Mar 20, 2026
Copilot AI requested a review from fffaraz March 20, 2026 17:48
@fffaraz fffaraz marked this pull request as ready for review March 20, 2026 17:59
@fffaraz fffaraz requested a review from Copilot March 20, 2026 17:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the existing Docker GitHub Actions workflow so that images are built on PRs but are published to GitHub Container Registry (ghcr.io) when changes are pushed to master.

Changes:

  • Add job-level packages: write permission to enable publishing to GHCR.
  • Replace the manual docker build step with Buildx + docker/build-push-action@v6.
  • Add GHCR login and docker/metadata-action@v5-driven tagging, pushing only on push events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +17
permissions:
contents: read
packages: write
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages: write is granted for the entire job, including pull_request runs. Even though the workflow doesn’t push on PRs, least-privilege is to avoid write-scoped tokens when executing PR code. Consider splitting into two jobs (PR build with read-only permissions, push job with packages: write and if: github.event_name == 'push'), or moving the publishing steps into a separate workflow triggered only on push to master with elevated permissions.

Copilot uses AI. Check for mistakes.
@fffaraz fffaraz merged commit 59e9730 into master Mar 20, 2026
6 checks passed
@fffaraz fffaraz deleted the copilot/update-docker-workflow-publish branch March 20, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants