Categorygithub.com/coryb/llblib
modulepackage
0.0.0-20240717143751-d5f93d301171
Repository: https://github.com/coryb/llblib.git
Documentation: pkg.go.dev

# README

Go Reference

llblib - Client library for moby/buildkit

This library facilitates using the Buildkit LLB client interfaces to dynamically create build graphs with Buildkit.

For usage please see the examples.

# Packages

No description provided by the author
Package progress provides a multiplexed buildkit progress display that can be used across multiple solves.
Package sockproxy will provide a tcp forwarding proxy as a buildkit session Attachable.

# Functions

AddCacheMounts is a helper function that calls llb.AddMount with the llb.AsPersistentCacheDir option with the provided mode.
AddDefaultEnv sets an ENV environment variable for the image, also records the environment variable to the image config.
AddDockerOnBuild records the ONBUILD instruction to the image config.
AddEnvs is a helper function over `llb.AddEnv` where the provided map will be added to the returned llb.StateOption.
AddExposedPort records an EXPOSE port to the image config.
AddLabel records a LABEL to the image config.
AddLabels records a LABEL to the image config.
AddVolume records a VOLUME to the image config.
ApplyRun is similar to llb.Run but also commits history to the image config.
BuildDefinition builds a definition and returns a state.
Chown is an llb.CopyOption to set the owner and group of the copied file.
Cmd records the CMD command arguments to the image config.
Copy will copy files from one state to another, and also commits history to the image config.
DefaultDir sets the WORKDIR working directory for the image, also records the WorkingDir to the image config.
DefaultUser sets the USER for the image, also records the User to the image config.
Diff is similar to llb.Diff but also commits history to the image config.
Digest returns the digest for the state.
DockerConf returns the path to the user's Docker config.json.
DockerDir returns the path to the user's Docker config dir.
Dockerfile will parse the provided dockerfile and construct an llb.State represented by the provided dockerfile instructions.
DockerHealthcheck records the HEALTHCHECK configuration to the image config.
DockerHost returns the value of the DOCKER_HOST env var, or the default.
DockerRunShell sets the SHELL for the image config.
DockerSave will stream the build state as docker image tar, the tar will be written to the output argument.
Download will trigger the buildkit exporter to export the solved state to the directory provided.
DropBuildError will cause OnError handlers to suppress the original error that triggered the OnError event.
Entrypoint records the ENTRYPOINT to image config.
ErrUnimplemented will return true if the provided error is a GRPC error and the GRPC status code matches `codes.Unimplemented`.
File implements an llb.StateOption where the provided llb.FileAction is applied to the llb.State.
Frontend will create an llb.State that is created via a frontend Request.
FrontendInput will attach the provided llb.State with the given name to the Frontend request.
FrontendOpt will add the name/value pair to the Opts for the Frontend request.
Getenv will fetch an env var stored on the context or default to calling os.Getenv.
Image is similar to llb.Image but the image config will be preserved so that the llb.State can be pushed to a registry.
IncludePatterns provides a llb.CopyOption that sets the provided patterns on the llb.Copy instruction.
LoadImageConfig will attempt to build the image config from values stored on the llb.State.
LoadImageResolver returns a llb.ImageMetaResolver stored on the context, or will return `nil` if no resolver is found.
LoadProgress returns a progress stored on the context, or a no-op progress.
LoadSession returns a session stored on the context, or nil.
LookupEnv will fetch a env var stored on the context or default to calling os.LookupEnv.
MarshalWithImageConfig marshals the state to a definition ensuring the image config state is preserved in the definition.
Merge is similar to llb.Merge but also commits history to the image config.
Mode is an llb.CopyOption to set the file mode of the copied file.
NewClient will return a new buildkit client.
NewSolver returns a new Solver to create buildkit requests.
OnError can be used to modify a Request to run a customized container with with the mount context from the failed buildkit request.
Persistent returns a MountPropagator for the provided root llb.State and any mounts found in the llb.RunOptions.
Platform assigns the provided platform to the image state and the image config.
RegistryPush will push the request build state to the registry.
ResolvedImage returns an llb.State where the image will be resolved with the image configuration applied to the state.
Run is similar to llb.Run but also commits history to the image config.
StopSignal records the STOPSIGNAL to the image config.
ToYAML will serialize the llb.States to a yaml sequence node where each node in the sequence represents the corresponding states passed in.
WithBuildArg can be used to set build args for the Dockerfile build.
WithBuildArgs can be used to set build args for the Dockerfile build.
WithBuildContext will set an additional build context for the Dockerfile build.
WithChmod creates a Chmod option with the provided os.FileMode.
WithCompression will set the compression type for the push.
WithCustomName allows using the provided text for the progress display when solving the Frontend request.
WithCwd sets the working directory used when relative paths are provided to the `Solver`.
WithDockerfileName will set the name of the Dockerfile to use for the build.
WithEnv is used to set env vars on a context.
WithImageResolver returns a context with the provided llb.ImageMetaResovler stored.
WithInput will set stdin in the container to the provided reader.
WithInsecurePush will allow pushing to an insecure registry.
WithLabel can be used to set the label used for the progress display of the request.
WithLock allows for synchronizing access to the container execution so only one is ever running at at time.
WithOutput will set the stdout and stderr in the container to the provided writers.
WithProgress returns a context with the provided Progress stored.
WithPushByDigest will push the image by digest.
WithRemoteBuildContext will set an additional build context for the Dockerfile build from a remote source.
WithResultHandler will add a handler to the request that will be called so that data can be extracted from the gateway result.
WithRun will apply the provide llb.RunOption to the container process.
WithSession returns a context with the provided session stored.
WithSetup can be used to start callbacks after the container process has started.
WithTarget will set the target for the Dockerfile build.
WithTargetPlatform will set the platform for the Dockerfile build.
WithTeardown can be used to cleanup resources after the container process has exited.
WithTTY will run the container with the provided in/out/err connected to the tty in the container.

# Constants

ExporterImageConfigKey is the key used to store the image config in the client.SolveResponse.ExporterResponse returned from Session.Do.

# Variables

AllowEmptyWildcard is an llb.CopyOption to indicate that it is not an error for a wildcard to have no matches from the source path.
AllowWildcard is an llb.CopyOption to indicate that wildcards are allowed in the source path.
AttemptUnpack is an llb.CopyOption to indicate that the source should be unpacked if it is an archive.
CopyDirContentsOnly is an llb.CopyOption to indicate that the contents of the src directory should be copied, rather than the directory itself.
CreateDestPath is an llb.CopyOption to indicate that the destination path should be created if it does not exist.
FollowSymlinks is an llb.CopyOption to indicate that symlinks should be followed when copying.
IgnoreCache can be used to invalidate existing cache for the Run operation forcing the Run operation to be executed again.

# Structs

ContainerConfig is the schema1-compatible configuration of the container that is committed into the image.
ContainerOptions are options used to create ad-hoc containers in buildkit.
History wraps ocispec.History but allows us to track which session added the history entry so we can safely mutate existing records.
ImageConfig holds the configuration for an image.
NullOption implements a generic no-op option for all of the option interfaces.
Request defines a buildkit request.
WithInsecure will modify the request to ensure the solve request has the `Insecure` entitlement provided.

# Interfaces

ContainerOption allows configuring an ad-hoc container.
DockerfileOption can be used to modify a Dockerfile request.
FdReader is an io.Reader that has a Fd file descriptor.
FrontendOption can be used to modify a Frontend request.
MountPropagator manages a collection of llb.States and run Mounts.
RegistryPushOption can be used to modify a registry push request.
RequestOption can be used to modify the requests.
Session provides a long running session used to solve requests.
Solver provides functions used to create and execute buildkit solve requests.
SolverOption can be used to modify how solve requests are generated.

# Type aliases

Chmod is a wrapper over os.FileMode to implement various llb options.
DockerfileOpts alias dockerfile2llb.ConvertOpt.
ForwardOption is the same as the llb.SSHOption, but renamed since it can be used without SSH for generic forwarding of tcp and unix sockets.
RunOptions is a helper to return a list of llb.RunOptions as a single llb.RunOption.