Skip to content

Docker Build & Push

Inputs

name description type required default
ref

Git ref to checkout (empty = checkout action default)

string false ""
image

Full image name (e.g. ghcr.io/owner/repo)

string false ghcr.io/${{ github.repository }}
context

Docker build context path

string false .
file

Path to the Dockerfile (relative to context)

string false ""
tags

Newline-separated extra tags to apply (in addition to auto-generated tags)

string false ""
tag-semver

Apply semver tag pattern (e.g. {{version}})

string false {{version}}
registry

Container registry to authenticate with

string false ghcr.io
build-args

Newline-separated list of build arguments

string false ""
platforms

Comma-separated list of target platforms (e.g. linux/amd64,linux/arm64)

string false ""
cache-from

Cache source for Docker build

string false type=gha
cache-to

Cache destination for Docker build

string false type=gha,mode=max
target

Docker build target stage

string false ""
download-artifact-name

Name of a build artifact to download before building (empty to skip)

string false ""
download-all-artifacts

Download all artifacts before building

boolean false false
download-artifact-path

Path to download the artifact to (relative to workspace)

string false ""
download-artifact-merge-multiple

Merge multiple artifacts into a single directory

boolean false true
download-artifact-continue-on-error

Continue workflow if artifact download fails

boolean false false
push

Push image to registry after building

boolean false true

Secrets

name description required
REGISTRY_USERNAME

Registry username (optional, defaults to github.repository_owner)

false
REGISTRY_PASSWORD

Registry password (optional, defaults to GITHUB_TOKEN)

false

Outputs

name description
image

Full image reference with digest

digest

Image digest

tags

Applied image tags (newline-separated)

Usage

jobs:
  job1:
    uses: infinite-automations/workflows/.github/workflows/docker.yml@v1.3.1
    with:
      ref:
      # Git ref to checkout (empty = checkout action default)
      #
      # Type: string
      # Required: false
      # Default: ""

      image:
      # Full image name (e.g. ghcr.io/owner/repo)
      #
      # Type: string
      # Required: false
      # Default: ghcr.io/${{ github.repository }}

      context:
      # Docker build context path
      #
      # Type: string
      # Required: false
      # Default: .

      file:
      # Path to the Dockerfile (relative to context)
      #
      # Type: string
      # Required: false
      # Default: ""

      tags:
      # Newline-separated extra tags to apply (in addition to auto-generated tags)
      #
      # Type: string
      # Required: false
      # Default: ""

      tag-semver:
      # Apply semver tag pattern (e.g. {{version}})
      #
      # Type: string
      # Required: false
      # Default: {{version}}

      registry:
      # Container registry to authenticate with
      #
      # Type: string
      # Required: false
      # Default: ghcr.io

      build-args:
      # Newline-separated list of build arguments
      #
      # Type: string
      # Required: false
      # Default: ""

      platforms:
      # Comma-separated list of target platforms (e.g. linux/amd64,linux/arm64)
      #
      # Type: string
      # Required: false
      # Default: ""

      cache-from:
      # Cache source for Docker build
      #
      # Type: string
      # Required: false
      # Default: type=gha

      cache-to:
      # Cache destination for Docker build
      #
      # Type: string
      # Required: false
      # Default: type=gha,mode=max

      target:
      # Docker build target stage
      #
      # Type: string
      # Required: false
      # Default: ""

      download-artifact-name:
      # Name of a build artifact to download before building (empty to skip)
      #
      # Type: string
      # Required: false
      # Default: ""

      download-all-artifacts:
      # Download all artifacts before building
      #
      # Type: boolean
      # Required: false
      # Default: false

      download-artifact-path:
      # Path to download the artifact to (relative to workspace)
      #
      # Type: string
      # Required: false
      # Default: ""

      download-artifact-merge-multiple:
      # Merge multiple artifacts into a single directory
      #
      # Type: boolean
      # Required: false
      # Default: true

      download-artifact-continue-on-error:
      # Continue workflow if artifact download fails
      #
      # Type: boolean
      # Required: false
      # Default: false

      push:
      # Push image to registry after building
      #
      # Type: boolean
      # Required: false
      # Default: true