buildkit

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildOptions

type BuildOptions struct {
	Dockerfile string            // Reserved for future use - currently unused
	Tag        string            // Image tag (e.g., "moat/run:abc123")
	ContextDir string            // Build context directory
	NoCache    bool              // Disable build cache
	Platform   string            // Target platform (e.g., "linux/amd64")
	BuildArgs  map[string]string // Build arguments
	Output     io.Writer         // Progress output (default: os.Stdout)
}

BuildOptions configures a BuildKit build.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps BuildKit client operations.

func NewClient

func NewClient() (*Client, error)

NewClient creates a BuildKit client. Connects to the address specified in BUILDKIT_HOST env var (e.g., "tcp://buildkit:1234")

func (*Client) Build

func (c *Client) Build(ctx context.Context, opts BuildOptions) error

Build executes a build using BuildKit.

The build process:

  1. Connects to BuildKit sidecar via BUILDKIT_HOST (tcp://buildkit:1234)
  2. Prepares build context from ContextDir using LocalMounts (BuildKit manages session internally)
  3. Executes build with dockerfile.v0 frontend
  4. Exports result as Docker image tar, piping directly to `docker load`

This approach avoids manual session management and filesync complexity by:

  • Using LocalMounts for build context (BuildKit auto-manages the filesync session)
  • Using Output function to stream the docker exporter tar to `docker load`

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping checks if BuildKit is reachable.

func (*Client) WaitForReady

func (c *Client) WaitForReady(ctx context.Context) error

WaitForReady waits for BuildKit to become ready with exponential backoff. BuildKit daemon takes ~5-10s to initialize after sidecar starts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL