This GitHub Action builds your Docker image and pushes it to GitHubβs Container Registry (GHCR).
- 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
Update the environment variable at the top of .github/workflows/docker-build.yml:
env:
DOCKERFILE_PATH: path/to/your/DockerfilePush your code with a commit message that includes:
docker:build added new features
- Go to the Actions tab
- Select the "Build & Push Docker Image to GHCR" workflow
- Click "Run workflow"
Two tags will be created:
:latestβ always points to the newest successful build:<commit SHA>β unique version for reference
You will need to create a Personal Access Token (PAT):
- Go to GitHub Developer Settings
- Click "Generate new token (classic)"
- Check the following scopes:
write:packagesread:packagesrepo(only if pushing from a private repo)
- Generate the token and copy it
- Add it as a secret named
GHCR_PATin your repository