Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CommandExecutor = exec.CommandContext
Exposing this as a dependency injection for testing purposes.
var ImagePath = fmt.Sprintf("%s/%s", os.TempDir(), "image")
var MetadataPath = fmt.Sprintf("%s/%s", os.TempDir(), "metadata.json")
Functions ¶
func ConnectRemoteDriver ¶
Connect the buildx to the buildkitd instance running on the socket (in the sidecar within this pod). Here buildx gets configured to use the remote driver. This method will block until it either see the remote driver fully connected or returns an unhandled error.
Types ¶
type BuildOption ¶
///////////////////////////////////////////////////////////////////////// Build Options
func WithArguments ¶
func WithArguments(arguments []Pair) BuildOption
Pair of Key/Value that will be passed as build arguments when building the image.
func WithRepository ¶
func WithRepository(repo *source.Repository) BuildOption
Use a fully configured repository
func WithSSHKeys ¶
func WithSSHKeys(keys []Pair) BuildOption
Pair of Key/Value that will be stored on disk and be passed to BuildKit so that the Dockerfile can mount those as ssh keys. https://docs.docker.com/build/building/secrets/#ssh-mounts
func WithSecrets ¶
func WithSecrets(secrets []Pair) BuildOption
Pair of Key/Value that will be stored on disk and be passed to BuildKit so that the Dockerfile can mount those secrets. https://docs.docker.com/build/building/secrets/
func WithTags ¶
func WithTags(tags ...string) BuildOption
List of tags to tag the image with. Will also be used with the cache layer. Requires at least one tag.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder(ref name.Reference, opts ...BuildOption) (*Builder, error)
Create a new Build ready to be executed. The reference is the registry reference that was used to configure the registry. It will be used to store the cache layers over to distribution. See the different BuildOption below to learn about the different options. Returns an error if any of the option passed fails to configure the Builder.
func (*Builder) Execute ¶
Build the repository into an ImageIndex (OCI Standard) The context is set around the repository which means it needs to be present in the filesystem.
The build execute buildkit as a system command directly and pipes both STDOUT and STDERR to their respective file descriptor.
The error that returns from Build is any error that is returned from the buildkit process.
The ImageIndex is generated from go-containerregistry and is a valid OCI ImageIndex that can be exported to any container registry.
Metadata from the build is return a valid JSON as a byteslice.
type Pair ¶
Argument represent a key/value pair that was passed in as an environment variable. In a linux system, it would be represented as a `KEY=Value` environment variable. The argument list is stored as a JSON payload, and those values needs to be extracted from it before it can be passed to buildkit.