Forgejo drop-in for docker/setup-buildx-action: create and bootstrap a docker buildx (BuildKit) builder, no github.com at runtime.
  • JavaScript 66.7%
  • Shell 27.5%
  • Makefile 5.8%
Find a file
Stephen Way e991e16ea1
All checks were successful
test / e2e (push) Successful in 7s
test / unit (push) Successful in 17s
Initial release: setup-buildx-action for Forgejo
Create and bootstrap a docker buildx (BuildKit) builder using the
runner's installed buildx, with no github.com download at runtime.
Drop-in for docker/setup-buildx-action: same input/output surface
(driver, driver-opts, buildkitd-flags/config, platforms, name, append,
install, use, cleanup, keep-state). Node20 action; the builder is torn
down in a best-effort post step.

The default docker-container driver is what enables registry cache
export and multi-platform, which the built-in docker driver cannot do;
this is the missing half that lets docker-build-action push a
cache-to type=registry image on a self-hosted runner.

Offline unit suite (fake docker on PATH) plus a live e2e workflow that
provisions the builder and builds a cache-exporting image end to end.
2026-05-31 10:04:32 -07:00
.forgejo/workflows Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
examples/workflows Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
src Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
tests Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
.gitignore Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
action.yml Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
CHANGELOG.md Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
LICENSE Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
Makefile Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
MIGRATION.md Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00
README.md Initial release: setup-buildx-action for Forgejo 2026-05-31 10:04:32 -07:00

Setup Docker Buildx (Forgejo)

Forgejo's missing docker/setup-buildx-action. Create and bootstrap a docker buildx (BuildKit) builder on a self-hosted Forgejo runner, using the buildx that already ships with the runner's Docker. No buildx binary is downloaded from github.com at runtime.

Part of the Fjord Actions bundle. Pairs with docker-build-action: this action provisions a docker-container builder (the one that supports registry cache export and multi-platform), then the build action uses it.

Why

The default Docker builder (the docker driver) cannot export a BuildKit cache to a registry (--cache-to type=registry) and cannot build multi-platform. For either you need a docker-container builder. docker/setup-buildx-action does that on GitHub but pulls a buildx release from github.com; this action does the same provisioning with the runner's installed buildx, so nothing in the hot path depends on github.com.

Usage

jobs:
  build:
    runs-on: linux-docker        # a runner with real Docker (host mode)
    steps:
      - uses: actions/checkout@v6

      - name: Set up Docker Buildx
        uses: https://rasterhub.com/rasterstate/setup-buildx-action@v1

      - name: Build and push
        uses: https://rasterhub.com/rasterstate/docker-build-action@v1
        with:
          context: .
          file: core/Dockerfile
          push: true
          tags: registry.example.com/app:latest
          cache-from: type=registry,ref=registry.example.com/app:buildcache
          cache-to: type=registry,ref=registry.example.com/app:buildcache,mode=max

Zero-config gives you a bootstrapped docker-container builder set as current (--use), torn down in a post step at job end.

Inputs

Input Default Description
driver docker-container Builder driver: docker-container, docker, kubernetes, remote.
driver-opts Driver options key=value, one per line (e.g. image=moby/buildkit:v0.16.0, network=host).
buildkitd-flags Flags for the buildkitd daemon (e.g. --allow-insecure-entitlement network.host).
buildkitd-config Path to a BuildKit daemon TOML config.
buildkitd-config-inline Inline BuildKit TOML; written to a temp file and passed as --config.
endpoint Optional node endpoint for the builder.
platforms Fixed platforms for the node, comma separated.
name auto Builder name. Required when append is true.
append false Append a node to the existing builder named by name.
install false Set buildx as the default docker build (docker buildx install). Reverted on cleanup.
use true Switch the current builder to the one created here.
cleanup true Remove the builder in the post step.
keep-state false Keep the BuildKit state volume on teardown (docker buildx rm --keep-state).
version Informational only; see MIGRATION.md.

Outputs

Output Description
name Name of the builder created or selected.
driver Builder driver.
platforms Comma-separated platforms available on the builder.
endpoint Endpoint of the first node.
status Status of the first node (e.g. running).
nodes JSON array of nodes (name, endpoint, status, platforms).

Requirements

A runner with a real Docker daemon and the buildx plugin (Docker 19.03+). On the Fjord stack that means a host-mode runner (the job runs on the VM and uses its Docker), not a job-container runner that only has the socket mounted.

Pinning BuildKit

The buildx CLI version is whatever the runner's Docker ships. To pin BuildKit (the thing that actually does the build), set the builder image, pulled from your registry or Docker Hub, never GitHub:

      - uses: https://rasterhub.com/rasterstate/setup-buildx-action@v1
        with:
          driver-opts: image=moby/buildkit:v0.16.0

See MIGRATION.md for the differences from docker/setup-buildx-action.

License

MIT, see LICENSE.