Repository: https://github.com/Netcracker/.github
Path: workflow-templates/dev-docker-build-single-image.yml
GitHub Actions workflow template for building and publishing one multi-platform Docker image to GitHub Container Registry (GHCR).
This template is part of the Netcracker / Qubership shared workflow collection.
Automatically (or manually) build and push a single Docker image from a repository that contains a Dockerfile in the root.
- Builds for linux/amd64 and linux/arm64
- Publishes to
ghcr.io/${{ github.repository }}(or custom name) - Supports dry-run mode
- Allows overriding image name and adding extra tags
- Skips execution on documentation-only or GitHub config changes
on:
workflow_dispatch: # manual trigger from GitHub UI
inputs:
custom-image-name
tags
dry-run
push:
branches: ['**']
paths-ignore: [ .github/**, docs/**, CODE-OF-CONDUCT.md, CONTRIBUTING.md, LICENSE, README.md, SECURITY.md ]
pull_request:
branches: ['**']
paths-ignore: [ same as above ]When running manually (Workflow Dispatch):
- custom-image-name:
mycompany/backend→ results inghcr.io/mycompany/backend:… - tags :
v1.2.3-test, debug→ additional tags - dry-run :
true→ build only, do not push
The workflow uses an internal metadata action that typically produces tags like:
ghcr.io/owner/repo:pr-45
ghcr.io/owner/repo:pr-45-abc1234 (short sha)
ghcr.io/owner/repo:branch-name
ghcr.io/owner/repo:20250116-abc1234
ghcr.io/owner/repo:latest (only on default branch in some configurations)→ Exact tags depend on the netcracker/qubership-workflow-hub/actions/metadata-action logic.
You can append extra tags using the tags input.
- Dockerfile must be in the root of the repository
- No custom build context / subfolder supported (use a different template if needed)
- Repository must have permission to write packages (
packages: write)
| Step | Action | Purpose |
|---|---|---|
| Checkout | actions/checkout@v6 |
Get source code |
| Create name / metadata | netcracker/qubership-workflow-hub/actions/metadata-action@v2.0.7 |
Generates base tag(s) |
| Prepare tags | Custom shell script | Combines base + manual tags |
| Build & Publish | netcracker/qubership-workflow-hub/actions/docker-action@v2.0.7 |
Main Docker buildx build & push |
permissions:
contents: read
packages: write # required to push to GHCR- Expects Dockerfile in repository root (no
docker buildx build --file path/Dockerfile) - No advanced
.dockerignoreor multi-stage override options exposed - No configurable build-args via workflow inputs (may be supported inside
docker-action) - Dry-run still performs the build (useful to verify multi-platform compatibility)
- Uses fixed platforms:
linux/amd64,linux/arm64
- Image not pushed? → Check
packages: writepermission &GITHUB_TOKENscope - Wrong image name? → Use
custom-image-nameinput - Want different platforms? → Currently hardcoded (fork or ask maintainers)
- Build fails on arm64? → Make sure your Dockerfile is multi-arch friendly
- Parent repository:
https://github.com/Netcracker/.github - Related template: likely exists for multi-image / Helm / release workflows in the same folder
- Internal action docs:
netcracker/qubership-workflow-hub
Happy building! 🐳