buildkit

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package buildkit provides a component for managing a persistent BuildKit daemon using containerd. BuildKit is used for building container images with layer caching across builds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	Log       *slog.Logger
	CC        *containerd.Client
	Namespace string
	DataPath  string
	// contains filtered or unexported fields
}

Component manages a persistent BuildKit daemon as a containerd container, or connects to an external BuildKit daemon via Unix socket.

func NewComponent

func NewComponent(log *slog.Logger, cc *containerd.Client, namespace, dataPath string) *Component

NewComponent creates a new BuildKit component that manages an embedded daemon.

func NewExternalComponent

func NewExternalComponent(log *slog.Logger, socketPath string) *Component

NewExternalComponent creates a BuildKit component that connects to an external daemon. No container lifecycle management is performed - it only provides client access.

func (*Component) Client

func (c *Component) Client(ctx context.Context) (*buildkitclient.Client, error)

Client returns a new BuildKit client connected to the daemon.

func (*Component) IsRunning

func (c *Component) IsRunning() bool

IsRunning returns whether the BuildKit daemon is running.

func (*Component) SetRegistryIP

func (c *Component) SetRegistryIP(ip string) error

SetRegistryIP updates the hosts file with the registry IP address for cluster.local. This can be called after Start() once the registry IP is known.

func (*Component) SocketPath

func (c *Component) SocketPath() string

SocketPath returns the path to the BuildKit Unix socket.

func (*Component) Start

func (c *Component) Start(ctx context.Context, config Config) error

Start starts the BuildKit daemon container. For external components, this verifies the socket is accessible.

func (*Component) Stop

func (c *Component) Stop(ctx context.Context) error

Stop stops the BuildKit daemon container. For external components, this is a no-op.

type Config

type Config struct {
	// SocketDir is the directory where the Unix socket will be created (e.g., /run/miren/buildkit)
	SocketDir string

	// RegistryIP is the IP address for cluster.local registry (optional, can be set later via SetRegistryIP)
	RegistryIP string

	// GCKeepStorage is the maximum bytes of cache to keep (default: 10GB)
	GCKeepStorage int64

	// GCKeepDuration is how long to keep cache entries in seconds (default: 7 days)
	GCKeepDuration int64

	// RegistryHost is the hostname for the cluster-local registry (e.g., cluster.local:5000)
	RegistryHost string
}

Config contains configuration for the BuildKit component.

Jump to

Keyboard shortcuts

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