Sunbeam Studios

Our open-source projects, here for you!

wfe-buildkit (1.4.0)

Published 2026-03-27 00:33:22 +00:00 by siennathesane

Installation

[registry]
default = "gitea"

[registries.gitea]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add wfe-buildkit@1.4.0

About this package

BuildKit image builder executor for WFE

wfe-buildkit

BuildKit image builder executor for WFE.

What it does

wfe-buildkit provides a BuildkitStep that implements the StepBody trait from wfe-core. It shells out to the buildctl CLI to build container images using BuildKit, capturing stdout/stderr and parsing image digests from the output.

Quick start

Use it standalone:

use wfe_buildkit::{BuildkitConfig, BuildkitStep};

let config = BuildkitConfig {
    dockerfile: "Dockerfile".to_string(),
    context: ".".to_string(),
    tags: vec!["myapp:latest".to_string()],
    push: true,
    ..Default::default()
};

let step = BuildkitStep::new(config);

// Inspect the command that would be executed.
let args = step.build_command();
println!("{}", args.join(" "));

Or use it through wfe-yaml with the buildkit feature:

workflow:
  id: build-image
  version: 1
  steps:
    - name: build
      type: buildkit
      config:
        dockerfile: Dockerfile
        context: .
        tags:
          - myapp:latest
          - myapp:v1.0
        push: true
        build_args:
          RUST_VERSION: "1.78"
        cache_from:
          - type=registry,ref=myapp:cache
        cache_to:
          - type=registry,ref=myapp:cache,mode=max
        timeout: 10m

Configuration

Field Type Required Default Description
dockerfile String Yes - Path to the Dockerfile
context String Yes - Build context directory
target String No - Multi-stage build target
tags Vec<String> No [] Image tags
build_args Map<String, String> No {} Build arguments
cache_from Vec<String> No [] Cache import sources
cache_to Vec<String> No [] Cache export destinations
push bool No false Push image after build
output_type String No "image" Output type: image, local, tar
buildkit_addr String No unix:///run/buildkit/buildkitd.sock BuildKit daemon address
tls TlsConfig No - TLS certificate paths
registry_auth Map<String, RegistryAuth> No {} Registry credentials
timeout_ms u64 No - Execution timeout in milliseconds

Output data

After execution, the step writes the following keys into output_data:

Key Description
{step_name}.digest Image digest (sha256:...), if found in output
{step_name}.tags Array of tags applied to the image
{step_name}.stdout Full stdout from buildctl
{step_name}.stderr Full stderr from buildctl

Testing

cargo test -p wfe-buildkit

The build_command() method returns the full argument list without executing, making it possible to test command construction without a running BuildKit daemon.

License

MIT

Dependencies

ID Version
async-trait ^0.1
hyper-util ^0.1
regex ^1
serde ^1
serde_json ^1
thiserror ^2
tokio ^1
tokio-stream ^0.1
tonic ^0.14
tower ^0.4
tracing ^0.1
uuid ^1
wfe-buildkit-protos ^1.4.0
wfe-core ^1.4.0
pretty_assertions ^1
tempfile ^3
tokio ^1
tokio-util ^0.7
Details
Cargo
2026-03-27 00:33:22 +00:00
0
MIT
22 KiB
Assets (1)
Versions (1) View all
1.4.0 2026-03-27