Skip to content

build-docker.yml

Build and push container images using Docker Buildx with optional multi-arch support.

Inputs

InputTypeDescriptionRequiredDefault
IMAGE_NAMEstringName of the image to buildYes-
IMAGE_TAGstringTag used to build imageYes-
LATEST_TAGbooleanWhether to tag the image with 'latest'Nofalse
IMAGE_DOCKERFILEstringPath of the DockerfileYes-
IMAGE_CONTEXTstringPath of the build contextYes-
BUILD_AMD64booleanBuild for amd64Notrue
BUILD_ARM64booleanBuild for arm64Notrue
USE_QEMUbooleanUse QEMU emulator for arm64Nofalse
REGISTRY_USERNAMEstringUsername used to login into registryNo-
REGISTRY_PASSWORDstringPassword used to login into registryNo-

Permissions

ScopeAccessDescription
packageswritePush images to GHCR when applicable
contentsreadRead repository to build context

Notes

  • Supports Ubuntu 24.04 and ARM runners for matrix builds.
  • LATEST_TAG input allows tagging images as latest.
  • Registry login logic: uses GitHub token for ghcr.io, otherwise uses provided credentials.
  • Digest artifacts are uploaded and merged for multi-arch images.
  • Manifest list is created and pushed after build.

Examples

Simple example

yaml
jobs:
  build:
    uses: this-is-tobi/github-workflows/.github/workflows/build-docker.yml@main
    with:
      IMAGE_NAME: ghcr.io/my-org/my-image
      IMAGE_TAG: 1.2.3
      IMAGE_CONTEXT: ./
      IMAGE_DOCKERFILE: ./Dockerfile
      LATEST_TAG: true
      BUILD_AMD64: true
      BUILD_ARM64: true
      USE_QEMU: false