Skip to content

GitHub Action: Build & Push Docker Image to quay.io, docker.io, ghcr.io#18

Merged
cniweb merged 4 commits intomasterfrom
copilot/fix-17
Jul 16, 2025
Merged

GitHub Action: Build & Push Docker Image to quay.io, docker.io, ghcr.io#18
cniweb merged 4 commits intomasterfrom
copilot/fix-17

Conversation

Copy link
Contributor

Copilot AI commented Jul 16, 2025

This PR implements a comprehensive GitHub Action workflow to automatically build and push Docker images to multiple container registries on every push to the main branch.

Changes Made

1. Created .github/workflows/docker-build.yml

  • Triggers on pushes to main branch only
  • Authenticates to all three registries using GitHub secrets:
    • Docker Hub (docker.io/cniweb/xmrig)
    • GitHub Container Registry (ghcr.io/cniweb/xmrig)
    • Quay.io (quay.io/cniweb/xmrig)
  • Tags images with both latest and commit SHA (${{ github.sha }})
  • Uses the existing build.sh script for building

2. Enhanced build.sh Script

  • Added support for build-only parameter to enable CI/CD usage
  • Maintains full backward compatibility for existing workflows
  • When called with ./build.sh build-only, builds the image but skips registry pushes

3. Updated README.md

  • Added build status badge for the new workflow
  • Enhanced registry documentation with clear usage examples
  • Added information about available tags (latest, <commit-sha>, version-specific)
  • Improved formatting and organization

Workflow Features

The workflow performs the following steps:

  1. Checkout code
  2. Authenticate to all three container registries
  3. Build Docker image using existing build.sh script in build-only mode
  4. Tag image for all registries with both latest and commit SHA
  5. Push tagged images to all three registries

Required Secrets

The following GitHub secrets need to be configured for the workflow to function:

  • DOCKERHUB_USERNAME and DOCKERHUB_TOKEN
  • GHCR_USERNAME and GHCR_TOKEN
  • QUAY_USERNAME and QUAY_PASSWORD

Benefits

  • Automated CI/CD: Images are automatically built and pushed on every main branch commit
  • Multi-registry support: Images available on Docker Hub, GHCR, and Quay.io for redundancy
  • Version tracking: Each commit gets its own tagged image for easy rollbacks
  • Backward compatibility: Existing build.sh usage remains unchanged

Fixes #17.


💡 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.

Copilot AI and others added 2 commits July 16, 2025 18:47
Co-authored-by: cniweb <2334906+cniweb@users.noreply.github.com>
…badge

Co-authored-by: cniweb <2334906+cniweb@users.noreply.github.com>
Copilot AI changed the title [WIP] GitHub Action: Build &amp; Push Docker Image to quay.io, docker.io, ghcr.io GitHub Action: Build & Push Docker Image to quay.io, docker.io, ghcr.io Jul 16, 2025
Copilot AI requested a review from cniweb July 16, 2025 18:49
@cniweb cniweb marked this pull request as ready for review July 16, 2025 18:51
@cniweb
Copy link
Owner

cniweb commented Jul 16, 2025

@copilot Tag images with both latest and as version (Parameter $version from build.sh)

Co-authored-by: cniweb <2334906+cniweb@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 16, 2025

@copilot Tag images with both latest and as version (Parameter $version from build.sh)

Updated the workflow to tag images with version from build.sh parameter. The workflow now extracts the version dynamically and tags images with latest, version (6.22.2), and commit SHA across all registries. Commit: 59c478b

Copy link
Owner

@cniweb cniweb left a comment

Choose a reason for hiding this comment

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

LGTM

@cniweb cniweb merged commit 24d39d4 into master Jul 16, 2025
2 checks passed
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.

GitHub Action: Build & Push Docker Image to quay.io, docker.io, ghcr.io

2 participants