Documentation
¶
Overview ¶
Package buildkit provides BuildKit client connectivity for whail.
This subpackage imports moby/buildkit and its transitive dependencies (gRPC, protobuf, containerd, opentelemetry). Consumers who only need whail's label-based Docker wrapper do not pay this cost — only importing this subpackage adds the dependency tree.
Usage:
engine, _ := whail.New(ctx) engine.BuildKitImageBuilder = buildkit.NewImageBuilder(engine.APIClient)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBuildKitClient ¶
NewBuildKitClient creates a BuildKit client connected to Docker's embedded buildkitd via the /grpc and /session hijack endpoints. This is the same connection pattern used by docker/buildx internally.
The caller is responsible for calling Close() on the returned client.
func NewImageBuilder ¶
func NewImageBuilder(apiClient DockerDialer) func(context.Context, whail.ImageBuildKitOptions) error
NewImageBuilder returns a closure that builds images using BuildKit's Solve API. The closure is intended to be set on Engine.BuildKitImageBuilder.
If apiClient is nil, the returned closure always returns an error.
Each invocation creates a fresh BuildKit client connection via DialHijack, runs Solve, and closes the connection. Label enforcement is handled by Engine.ImageBuildKit before the closure is called — the closure receives already-merged labels.
Usage:
engine, _ := whail.New(ctx) engine.BuildKitImageBuilder = buildkit.NewImageBuilder(engine.APIClient)
func VerifyConnection ¶
VerifyConnection checks that the BuildKit client can communicate with the daemon and at least one worker is available. This is a spike/diagnostic function — production code should just call Solve and handle errors.