Documentation ¶
Overview ¶
Package build provides configuring options for building images and handling build arguments.
Index ¶
- type BuildArgs
- type Opt
- func WithAlwaysRemoveIntermediateContainers() Opt
- func WithBuildArg(barg string) Opt
- func WithBuildArgs(bargs ...string) Opt
- func WithDockerfile(name string) Opt
- func WithLabel(label string) Opt
- func WithLabels(labels ...string) Opt
- func WithOpts(opts types.ImageBuildOptions) Opt
- func WithOutput(w io.Writer) Opt
- func WithPullAlways() Opt
- func WithRemoveIntermediateContainers() Opt
- func WithSquash() Opt
- func WithTag(nametag string) Opt
- func WithoutCache() Opt
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildArgs ¶
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 ¶
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.
type Opt ¶
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 ¶
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 ¶
WithBuildArgs specifies multiple image build arguments. See also: WithBuildArg.
func WithDockerfile ¶
WithDockerfile specifies the name of the Dockerfile.
func WithLabels ¶
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 ¶
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 ¶
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).