Documentation ¶
Index ¶
- Constants
- func BuildDockerfiles(ctx context.Context, store storage.Store, options define.BuildOptions, ...) (id string, ref reference.Canonical, err error)
- func InitReexec() bool
- type BuildOptions
- type Executor
- type Mount
- type StageExecutor
- func (s *StageExecutor) Copy(excludes []string, copies ...imagebuilder.Copy) error
- func (s *StageExecutor) Delete() (err error)
- func (s *StageExecutor) EnsureContainerPath(path string) error
- func (s *StageExecutor) EnsureContainerPathAs(path, user string, mode *os.FileMode) error
- func (s *StageExecutor) Execute(ctx context.Context, base string) (imgID string, ref reference.Canonical, onlyBaseImg bool, err error)
- func (s *StageExecutor) Preserve(path string) error
- func (s *StageExecutor) Run(run imagebuilder.Run, config docker.Config) error
- func (s *StageExecutor) UnrecognizedInstruction(step *imagebuilder.Step) error
Constants ¶
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.
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) EnsureContainerPathAs ¶ added in v1.25.1
func (s *StageExecutor) EnsureContainerPathAs(path, user string, mode *os.FileMode) error
func (*StageExecutor) Execute ¶ added in v1.7.2
func (s *StageExecutor) Execute(ctx context.Context, base string) (imgID string, ref reference.Canonical, onlyBaseImg bool, 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. When CompatVolumes is enabled, 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.