Skip to content

codeworks-templates/ghcr_trigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Build & Push Docker Image to GHCR

This GitHub Action builds your Docker image and pushes it to GitHub’s Container Registry (GHCR).


✨ Features

  • Multi-platform builds (AMD64 + ARM64)
  • Pushes to GHCR with latest and commit SHA tags
  • Triggers automatically on commit with docker:build
  • Supports manual trigger via GitHub UI

βš–οΈ Configuration

1. Set Your Dockerfile Path

Update the environment variable at the top of .github/workflows/docker-build.yml:

env:
  DOCKERFILE_PATH: path/to/your/Dockerfile

πŸš€ How to Trigger a Build

Option 1: Commit with a Special Message

Push your code with a commit message that includes:

docker:build added new features

Option 2: Run It Manually

  1. Go to the Actions tab
  2. Select the "Build & Push Docker Image to GHCR" workflow
  3. Click "Run workflow"

πŸ” Tags

Two tags will be created:

  • :latest β€” always points to the newest successful build
  • :<commit SHA> β€” unique version for reference

πŸ” Secrets

You will need to create a Personal Access Token (PAT):

✨ How to Create a PAT for GHCR

  1. Go to GitHub Developer Settings
  2. Click "Generate new token (classic)"
  3. Check the following scopes:
    • write:packages
    • read:packages
    • repo (only if pushing from a private repo)
  4. Generate the token and copy it
  5. Add it as a secret named GHCR_PAT in your repository

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published