imagebuildah

package
v1.23.4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 45 Imported by: 34

Documentation

Index

Constants

View Source
const (
	PullIfMissing = define.PullIfMissing
	PullAlways    = define.PullAlways
	PullIfNewer   = define.PullIfNewer
	PullNever     = define.PullNever

	Gzip         = archive.Gzip
	Bzip2        = archive.Bzip2
	Xz           = archive.Xz
	Zstd         = archive.Zstd
	Uncompressed = archive.Uncompressed
)

Variables

This section is empty.

Functions

func BuildDockerfiles

func BuildDockerfiles(ctx context.Context, store storage.Store, options define.BuildOptions, paths ...string) (id string, ref reference.Canonical, err error)

BuildDockerfiles parses a set of one or more Dockerfiles (which may be URLs), creates one or more new Executors, and then runs Prepare/Execute/Commit/Delete over the entire set of instructions. If the Manifest option is set, returns the ID of the manifest list, else it returns the ID of the built image, and if a name was assigned to it, a canonical reference for that image.

func InitReexec

func InitReexec() bool

InitReexec is a wrapper for buildah.InitReexec(). It should be called at the start of main(), and if it returns true, main() should return successfully immediately.

Types

type BuildOptions

type BuildOptions = define.BuildOptions

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor is a buildah-based implementation of the imagebuilder.Executor interface. It coordinates the entire build by using one or more StageExecutors to handle each stage of the build.

func (*Executor) Build

func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (imageID string, ref reference.Canonical, err error)

Build takes care of the details of running Prepare/Execute/Commit/Delete over each of the one or more parsed Dockerfiles and stages.

type Mount

type Mount = specs.Mount

Mount is a mountpoint for the build container.

type StageExecutor added in v1.7.2

type StageExecutor struct {
	// contains filtered or unexported fields
}

StageExecutor bundles up what we need to know when executing one stage of a (possibly multi-stage) build. Each stage may need to produce an image to be used as the base in a later stage (with the last stage's image being the end product of the build), and it may need to leave its working container in place so that the container's root filesystem's contents can be used as the source for a COPY instruction in a later stage. Each stage has its own base image, so it starts with its own configuration and set of volumes. If we're naming the result of the build, only the last stage will apply that name to the image that it produces.

func (*StageExecutor) Copy added in v1.7.2

func (s *StageExecutor) Copy(excludes []string, copies ...imagebuilder.Copy) error

Copy copies data into the working tree. The "Download" field is how imagebuilder tells us the instruction was "ADD" and not "COPY".

func (*StageExecutor) Delete added in v1.7.2

func (s *StageExecutor) Delete() (err error)

Delete deletes the stage's working container, if we have one.

func (*StageExecutor) EnsureContainerPath added in v1.7.2

func (s *StageExecutor) EnsureContainerPath(path string) error

func (*StageExecutor) Execute added in v1.7.2

func (s *StageExecutor) Execute(ctx context.Context, base string) (imgID string, ref reference.Canonical, err error)

Execute runs each of the steps in the stage's parsed tree, in turn.

func (*StageExecutor) Preserve added in v1.7.2

func (s *StageExecutor) Preserve(path string) error

Preserve informs the stage executor that from this point on, it needs to ensure that only COPY and ADD instructions can modify the contents of this directory or anything below it. The StageExecutor handles this by caching the contents of directories which have been marked this way before executing a RUN instruction, invalidating that cache when an ADD or COPY instruction sets any location under the directory as the destination, and using the cache to reset the contents of the directory tree after processing each RUN instruction. It would be simpler if we could just mark the directory as a read-only bind mount of itself during Run(), but the directory is expected to be remain writeable while the RUN instruction is being handled, even if any changes made within the directory are ultimately discarded.

func (*StageExecutor) Run added in v1.7.2

func (s *StageExecutor) Run(run imagebuilder.Run, config docker.Config) error

Run executes a RUN instruction using the stage's current working container as a root directory.

func (*StageExecutor) UnrecognizedInstruction added in v1.7.2

func (s *StageExecutor) UnrecognizedInstruction(step *imagebuilder.Step) error

UnrecognizedInstruction is called when we encounter an instruction that the imagebuilder parser didn't understand.

Jump to

Keyboard shortcuts

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