imagebuildah

package
v0.0.0-...-6284537 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullIfMissing       = buildah.PullIfMissing
	PullAlways          = buildah.PullAlways
	PullNever           = buildah.PullNever
	DefaultRuntime      = buildah.DefaultRuntime
	OCIv1ImageFormat    = buildah.OCIv1ImageManifest
	Dockerv2ImageFormat = buildah.Dockerv2ImageManifest

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

Variables

This section is empty.

Functions

func BuildDockerfiles

func BuildDockerfiles(store storage.Store, options BuildOptions, dockerfile ...string) error

BuildDockerfiles parses a set of one or more Dockerfiles (which may be URLs), creates a new Executor, and then runs Prepare/Execute/Commit/Delete over the entire set of instructions.

func BuildReadClosers

func BuildReadClosers(store storage.Store, options BuildOptions, dockerfile ...io.ReadCloser) error

BuildReadClosers parses a set of one or more already-opened Dockerfiles, creates a new Executor, and then runs Prepare/Execute/Commit/Delete over the entire set of instructions.

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 immediately.

func TempDirForURL

func TempDirForURL(dir, prefix, url string) (name string, subdir string, err error)

TempDirForURL checks if the passed-in string looks like a URL. If it is, TempDirForURL creates a temporary directory, arranges for its contents to be the contents of that URL, and returns the temporary directory's path, along with the name of a subdirectory which should be used as the build context (which may be empty or "."). Removal of the temporary directory is the responsibility of the caller. If the string doesn't look like a URL, TempDirForURL returns empty strings and a nil error code.

Types

type BuildOptions

type BuildOptions struct {
	// ContextDirectory is the default source location for COPY and ADD
	// commands.
	ContextDirectory string
	// PullPolicy controls whether or not we pull images.  It should be one
	// of PullIfMissing, PullAlways, or PullNever.
	PullPolicy int
	// Registry is a value which is prepended to the image's name, if it
	// needs to be pulled and the image name alone can not be resolved to a
	// reference to a source image.
	Registry string
	// IgnoreUnrecognizedInstructions tells us to just log instructions we
	// don't recognize, and try to keep going.
	IgnoreUnrecognizedInstructions bool
	// Quiet tells us whether or not to announce steps as we go through them.
	Quiet bool
	// Runtime is the name of the command to run for RUN instructions.  It
	// should accept the same arguments and flags that runc does.
	Runtime string
	// RuntimeArgs adds global arguments for the runtime.
	RuntimeArgs []string
	// TransientMounts is a list of mounts that won't be kept in the image.
	TransientMounts []Mount
	// Compression specifies the type of compression which is applied to
	// layer blobs.  The default is to not use compression, but
	// archive.Gzip is recommended.
	Compression archive.Compression
	// Arguments which can be interpolated into Dockerfiles
	Args map[string]string
	// Name of the image to write to.
	Output string
	// Additional tags to add to the image that we write, if we know of a
	// way to add them.
	AdditionalTags []string
	// Log is a callback that will print a progress message.  If no value
	// is supplied, the message will be sent to Err (or os.Stderr, if Err
	// is nil) by default.
	Log func(format string, args ...interface{})
	// Out is a place where non-error log messages are sent.
	Out io.Writer
	// Err is a place where error log messages should be sent.
	Err io.Writer
	// SignaturePolicyPath specifies an override location for the signature
	// policy which should be used for verifying the new image as it is
	// being written.  Except in specific circumstances, no value should be
	// specified, indicating that the shared, system-wide default policy
	// should be used.
	SignaturePolicyPath string
	// ReportWriter is an io.Writer which will be used to report the
	// progress of the (possible) pulling of the source image and the
	// writing of the new image.
	ReportWriter io.Writer
	// OutputFormat is the format of the output image's manifest and
	// configuration data.
	// Accepted values are OCIv1ImageFormat and Dockerv2ImageFormat.
	OutputFormat string
}

BuildOptions can be used to alter how an image is built.

type Executor

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

Executor is a buildah-based implementation of the imagebuilder.Executor interface.

func NewExecutor

func NewExecutor(store storage.Store, options BuildOptions) (*Executor, error)

NewExecutor creates a new instance of the imagebuilder.Executor interface.

func (*Executor) Build

func (b *Executor) Build(ib *imagebuilder.Builder, node []*parser.Node) (err error)

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

func (*Executor) Commit

func (b *Executor) Commit(ib *imagebuilder.Builder) (err error)

Commit writes the container's contents to an image, using a passed-in tag as the name if there is one, generating a unique ID-based one otherwise.

func (*Executor) Copy

func (b *Executor) 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 (*Executor) Delete

func (b *Executor) Delete() (err error)

Delete deletes the working container, if we have one. The Executor object should not be used to build another image, as the name of the output image isn't resettable.

func (*Executor) Execute

func (b *Executor) Execute(ib *imagebuilder.Builder, node *parser.Node) error

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

func (*Executor) Prepare

func (b *Executor) Prepare(ib *imagebuilder.Builder, node *parser.Node, from string) error

Prepare creates a working container based on specified image, or if one isn't specified, the first FROM instruction we can find in the parsed tree.

func (*Executor) Preserve

func (b *Executor) Preserve(path string) error

Preserve informs the 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 Executor 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, even if any changes within it are ultimately discarded.

func (*Executor) Run

func (b *Executor) Run(run imagebuilder.Run, config docker.Config) error

Run executes a RUN instruction using the working container as a root directory.

func (*Executor) UnrecognizedInstruction

func (b *Executor) UnrecognizedInstruction(step *imagebuilder.Step) error

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

type Mount

type Mount specs.Mount

Mount is a mountpoint for the build container.

Jump to

Keyboard shortcuts

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