build

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package build provides configuring options for building images and handling build arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildArgs

type BuildArgs map[string]*string

BuildArgs represents (image) build arguments, where these build arguments can either represent key-value pairs (including empty values), or a nil-valued key. A nil-valued key indicates that the default value should be taken (as opposed to an empty “” value).

func MakeBuildArgs

func MakeBuildArgs(bargs ...string) (BuildArgs, error)

MakeBuildArgs parses the passed build arguments in either of the three forms “foo=bar”, “foo=” and “foo”, returning a BuildArgs map for use in building image options. In case of invalid build arguments, such as “=” and “=foo”, it returns an error instead of nil.

func (BuildArgs) Add

func (b BuildArgs) Add(barg string) error

Add a single build argument to a BuildArgs map, where the build argument is in either of the three forms “foo=bar”, “foo=” and “foo”. If the build argument is in an invalid format, then Add returns an error, otherwise nil.

type Opt

type Opt func(*Options) error

Opt is a configuration option to build a container image using github.com/thediveo/morbyd.Session.BuildImage.

func WithAlwaysRemoveIntermediateContainers

func WithAlwaysRemoveIntermediateContainers() Opt

WithAlwaysRemoveIntermediateContainers always removes intermediate containers, even upon image build failure.

func WithBuildArg

func WithBuildArg(barg string) Opt

WithBuildArg specifies an image build argument, in either of the three forms “foo=bar”, “foo=” and “foo”. Please note that “foo=” and “foo” specify different things: “foo=” specifies a build arg named “foo” with an empty value “”, whereas “foo” specifies an unset (null valued) build arg named “foo”. WithBuildArg can be specified multiple times.

func WithBuildArgs

func WithBuildArgs(bargs ...string) Opt

WithBuildArgs specifies multiple image build arguments. See also: WithBuildArg.

func WithDockerfile

func WithDockerfile(name string) Opt

WithDockerfile specifies the name of the Dockerfile.

func WithLabel

func WithLabel(label string) Opt

WithLabel adds a key-value label to the built image.

func WithLabels

func WithLabels(labels ...string) Opt

WithLabels adds multiple key-value labels to the built image.

func WithOpts

func WithOpts(opts types.ImageBuildOptions) Opt

WithOpts (re)sets all image build options to the specified settings at once, with the sole exception of an optional output writer for image build process output (that needs to set independently using WithImageBuildOutput).

func WithOutput

func WithOutput(w io.Writer) Opt

WithOutput set the writer to which the output of the image build process is sent to.

func WithPullAlways

func WithPullAlways() Opt

WithPullAlways attempts to pull the parent image even if an older image exists locally.

func WithRemoveIntermediateContainers

func WithRemoveIntermediateContainers() Opt

WithRemoveIntermediateContainers removes intermediate containers after a successful build.

func WithSquash

func WithSquash() Opt

WithSquash creates a new image from the parent with all changes applied to this single new layer.

func WithTag

func WithTag(nametag string) Opt

WithTag specifies a name and optionally tag in “name:tag” format. This option can be specified multiple times so that the built image will be tagged with these multiple tags. If the “:tag” part is omitted, the default “:latest” is assumed.

func WithoutCache

func WithoutCache() Opt

WithoutCache specifies to never use the cache when building the image.

type Options

type Options struct {
	Out io.Writer
	types.ImageBuildOptions
}

Options represents the plethora of configuration options when building a container image, as well as additional configuration options for handling the output of build processes.

See also: Build an image (Docker API).

Jump to

Keyboard shortcuts

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