dockerfile

package
v17.10.0-ce-rc1+incomp... Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Overview

Package dockerfile is the evaluation step in the Dockerfile parse/evaluate pipeline.

It incorporates a dispatch table based on the parser.Node values (see the parser package for more information) that are yielded from the parser itself. Calling newBuilder with the BuildOpts struct can be used to customize the experience for execution purposes only. Parsing is controlled in the parser package, and this division of responsibility should be respected.

Please see the jump table targets for the actual invocations, most of which will call out to the functions in internals.go to deal with their tasks.

ONBUILD is a special case, which is covered in the onbuild() func in dispatchers.go.

The evaluator uses the concept of "steps", which are usually each processable line in the Dockerfile. Each step is numbered and certain actions are taken before and after each step, such as creating an image ID and removing temporary containers and images. Note that ONBUILD creates a kinda-sorta "sub run" which includes its own set of steps (usually only one of them).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildFromConfig

func BuildFromConfig(config *container.Config, changes []string) (*container.Config, error)

BuildFromConfig builds directly from `changes`, treating it as if it were the contents of a Dockerfile It will: - Call parse.Parse() to get an AST root for the concatenated Dockerfile entries. - Do build by calling builder.dispatch() to call all entries' handling routines

BuildFromConfig is used by the /commit endpoint, with the changes coming from the query parameter of the same name.

TODO: Remove?

Types

type Archiver

type Archiver interface {
	TarUntar(src, dst string) error
	UntarPath(src, dst string) error
	CopyWithTar(src, dst string) error
	CopyFileWithTar(src, dst string) error
	IDMappings() *idtools.IDMappings
}

Archiver defines an interface for copying files from one destination to another using Tar/Untar.

type BuildManager added in v1.11.0

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

BuildManager is shared across all Builder objects

func NewBuildManager added in v1.11.0

func NewBuildManager(b builder.Backend, sg SessionGetter, fsCache *fscache.FSCache, idMappings *idtools.IDMappings) (*BuildManager, error)

NewBuildManager creates a BuildManager

func (*BuildManager) Build added in v1.11.0

func (bm *BuildManager) Build(ctx context.Context, config backend.BuildConfig) (*builder.Result, error)

Build starts a new build from a BuildConfig

type Builder

type Builder struct {
	Stdout io.Writer
	Stderr io.Writer
	Aux    *streamformatter.AuxFormatter
	Output io.Writer
	// contains filtered or unexported fields
}

Builder is a Dockerfile builder It implements the builder.Backend interface.

type ClientSessionSourceIdentifier

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

ClientSessionSourceIdentifier is an identifier that can be used for requesting files from remote client

func NewClientSessionSourceIdentifier

func NewClientSessionSourceIdentifier(ctx context.Context, sg SessionGetter, uuid string) (*ClientSessionSourceIdentifier, error)

NewClientSessionSourceIdentifier returns new ClientSessionSourceIdentifier instance

func (*ClientSessionSourceIdentifier) Key

Key returns unique key for remote identifier. Requests with same key return same data.

func (*ClientSessionSourceIdentifier) SharedKey

func (csi *ClientSessionSourceIdentifier) SharedKey() string

SharedKey returns shared key for remote identifier. Shared key is used for finding the base for a repeated transfer.

func (*ClientSessionSourceIdentifier) Transport

func (csi *ClientSessionSourceIdentifier) Transport() string

Transport returns transport identifier for remote identifier

type ClientSessionTransport

type ClientSessionTransport struct{}

ClientSessionTransport is a transport for copying files from docker client to the daemon.

func NewClientSessionTransport

func NewClientSessionTransport() *ClientSessionTransport

NewClientSessionTransport returns new ClientSessionTransport instance

func (*ClientSessionTransport) Copy

Copy data from a remote to a destination directory.

type ImageProber

type ImageProber interface {
	Reset()
	Probe(parentID string, runConfig *container.Config) (string, error)
}

ImageProber exposes an Image cache to the Builder. It supports resetting a cache.

type SessionGetter

type SessionGetter interface {
	Get(ctx context.Context, uuid string) (session.Caller, error)
}

SessionGetter is object used to get access to a session by uuid

type ShellLex

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

ShellLex performs shell word splitting and variable expansion.

ShellLex takes a string and an array of env variables and process all quotes (" and ') as well as $xxx and ${xxx} env variable tokens. Tries to mimic bash shell process. It doesn't support all flavors of ${xx:...} formats but new ones can be added by adding code to the "special ${} format processing" section

func NewShellLex

func NewShellLex(escapeToken rune) *ShellLex

NewShellLex creates a new ShellLex which uses escapeToken to escape quotes.

func (*ShellLex) ProcessWord

func (s *ShellLex) ProcessWord(word string, env []string) (string, error)

ProcessWord will use the 'env' list of environment variables, and replace any env var references in 'word'.

func (*ShellLex) ProcessWords

func (s *ShellLex) ProcessWords(word string, env []string) ([]string, error)

ProcessWords will use the 'env' list of environment variables, and replace any env var references in 'word' then it will also return a slice of strings which represents the 'word' split up based on spaces - taking into account quotes. Note that this splitting is done **after** the env var substitutions are done. Note, each one is trimmed to remove leading and trailing spaces (unless they are quoted", but ProcessWord retains spaces between words.

Directories

Path Synopsis
Package command contains the set of Dockerfile commands.
Package command contains the set of Dockerfile commands.
Package parser implements a parser and parse tree dumper for Dockerfiles.
Package parser implements a parser and parse tree dumper for Dockerfiles.

Jump to

Keyboard shortcuts

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