Skip to content

Deploy — Docker

Builds a multi-platform Docker image and pushes it to GitHub Container Registry (GHCR).

Usage

yaml
jobs:
  docker:
    uses: KevinDeBenedetti/github-workflows/.github/workflows/deploy-docker.yml@main
    with:
      image-name: my-api
      platforms: linux/amd64,linux/arm64

Inputs

InputTypeDefaultDescription
image-namestring''Image name (e.g. my-api). Defaults to the repository name.
contextstring'.'Docker build context (e.g. apps/api)
dockerfilestringDockerfilePath to the Dockerfile, relative to context
platformsstringlinux/amd64,linux/arm64Comma-separated target platforms
pushbooleantruePush image to GHCR
tag-latestbooleanfalseAlso tag the image as :latest on the default branch

Outputs

OutputDescription
imageFull image reference with all tags
digestImage digest

Tags applied

EventTag
Branch push<branch-name>
Pull requestpr-<number>
Semver tag<version>, <major>.<minor>
Any commitsha-<short-sha>
Default branch + tag-latest: truelatest

Notes

  • Uses docker/metadata-action for automatic tag and label generation.
  • Build cache is scoped per context using GitHub Actions cache (type=gha).
  • The job runs in the production environment on main, otherwise preview.
  • Requires packages: write permission (granted automatically via GITHUB_TOKEN).