docker: github.com/docker/docker/builder/dockerfile Index | Files

package dockerfile

import "github.com/docker/docker/builder/dockerfile"

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

Package Files

buildargs.go builder.go builder_unix.go containerbackend.go copy.go copy_unix.go dispatchers.go dispatchers_unix.go evaluator.go imagecontext.go imageprobe.go internals.go internals_linux.go metrics.go

func BuildFromConfig Uses

func BuildFromConfig(config *container.Config, changes []string, os 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?

type Archiver Uses

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

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

type BuildArgs Uses

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

BuildArgs manages arguments used by the builder

func NewBuildArgs Uses

func NewBuildArgs(argsFromOptions map[string]*string) *BuildArgs

NewBuildArgs creates a new BuildArgs type

func (*BuildArgs) AddArg Uses

func (b *BuildArgs) AddArg(key string, value *string)

AddArg adds a new arg that can be used by directives

func (*BuildArgs) AddMetaArg Uses

func (b *BuildArgs) AddMetaArg(key string, value *string)

AddMetaArg adds a new meta arg that can be used by FROM directives

func (*BuildArgs) Clone Uses

func (b *BuildArgs) Clone() *BuildArgs

Clone returns a copy of the BuildArgs type

func (*BuildArgs) FilterAllowed Uses

func (b *BuildArgs) FilterAllowed(filter []string) []string

FilterAllowed returns all allowed args without the filtered args

func (*BuildArgs) GetAllAllowed Uses

func (b *BuildArgs) GetAllAllowed() map[string]string

GetAllAllowed returns a mapping with all the allowed args

func (*BuildArgs) GetAllMeta Uses

func (b *BuildArgs) GetAllMeta() map[string]string

GetAllMeta returns a mapping with all the meta args

func (*BuildArgs) IsReferencedOrNotBuiltin Uses

func (b *BuildArgs) IsReferencedOrNotBuiltin(key string) bool

IsReferencedOrNotBuiltin checks if the key is a built-in arg, or if it has been referenced by the Dockerfile. Returns true if the arg is not a builtin or if the builtin has been referenced in the Dockerfile.

func (*BuildArgs) MergeReferencedArgs Uses

func (b *BuildArgs) MergeReferencedArgs(other *BuildArgs)

MergeReferencedArgs merges referenced args from another BuildArgs object into the current one

func (*BuildArgs) ResetAllowed Uses

func (b *BuildArgs) ResetAllowed()

ResetAllowed clears the list of args that are allowed to be used by a directive

func (*BuildArgs) WarnOnUnusedBuildArgs Uses

func (b *BuildArgs) WarnOnUnusedBuildArgs(out io.Writer)

WarnOnUnusedBuildArgs checks if there are any leftover build-args that were passed but not consumed during build. Print a warning, if there are any.

type BuildManager Uses

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

BuildManager is shared across all Builder objects

func NewBuildManager Uses

func NewBuildManager(b builder.Backend, identityMapping *idtools.IdentityMapping) (*BuildManager, error)

NewBuildManager creates a BuildManager

func (*BuildManager) Build Uses

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

Build starts a new build from a BuildConfig

type Builder Uses

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 ImageProber Uses

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.

Package dockerfile imports 56 packages (graph) and is imported by 506 packages. Updated 2020-11-17. Refresh now. Tools for package owners.