Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 11, 2025

Overview

Fixes the missing latest Docker image tag by updating the CD workflow to automatically create it when building from the main branch.

Problem

The repository already had complete Docker image build infrastructure and documentation, but the CD workflow wasn't creating a latest tag. Users following the README documentation would find that ghcr.io/chrisw-dev/golang-mock-oauth2-server:latest didn't exist, forcing them to clone and build locally or use SHA-based tags.

Solution

Added a single line to the Docker metadata action configuration in .github/workflows/cd.yml:

type=raw,value=latest,enable={{is_default_branch}}

This ensures that builds from the main branch automatically create a latest tag alongside the existing branch and SHA tags.

Result

Users can now pull and use the pre-built image directly from GitHub Container Registry without needing to build it themselves:

# Pull the latest image
docker pull ghcr.io/chrisw-dev/golang-mock-oauth2-server:latest

# Run it directly
docker run -p 8080:8080 ghcr.io/chrisw-dev/golang-mock-oauth2-server:latest

Docker image tags now created:

  • Main branch pushes: main, sha-XXXXXXX, latest (new)
  • Version tag pushes (e.g., v1.0.0): 1.0.0, 1.0, sha-XXXXXXX

This aligns the actual workflow behavior with what's already documented in the README.

Testing

  • ✅ All existing Go tests pass
  • ✅ YAML syntax validated
  • ✅ No breaking changes
  • ✅ Minimal, surgical modification (1 line added)

Closes #[issue_number]

Original prompt

This section details on the original issue you should resolve

<issue_title>[FEATURE] Create docker image and share</issue_title>
<issue_description>## Problem Statement
When using this tool I need to clone the repo and then build a docker image. I'd like to just be abe to use an existing image hosted in a registry

Proposed Solution

Create a container image and build it as part of the release process for this repo. It should be stored in an appropriate registry so that the image can be used in other projects.

Alternative Solutions

No other options considered

Implementation Details

none

Additional Context

n/a</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #1


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: chrisw-dev <68233262+chrisw-dev@users.noreply.github.com>
Copilot AI changed the title [WIP] Create docker image and share in registry Add latest tag to Docker image builds for main branch Oct 11, 2025
Copilot AI requested a review from chrisw-dev October 11, 2025 16:26
@chrisw-dev chrisw-dev marked this pull request as ready for review October 11, 2025 17:25
@chrisw-dev chrisw-dev merged commit cbf5978 into main Oct 11, 2025
2 checks passed
@chrisw-dev chrisw-dev deleted the copilot/create-docker-image branch October 11, 2025 19:15
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.

[FEATURE] Create docker image and share

2 participants