builder

package
v1.8.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2015 License: Apache-2.0 Imports: 49 Imported by: 1

Documentation

Overview

Package builder 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 resposibility 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

View Source
const (
	// NoBaseImageSpecifier is the symbol used by the FROM
	// command to specify that no base image is to be used.
	NoBaseImageSpecifier string = "scratch"
)

Variables

This section is empty.

Functions

func Build added in v1.7.0

func Build(d *daemon.Daemon, buildConfig *Config) error

Build is the main interface of the package, it gathers the Builder struct and calls builder.Run() to do all the real build job.

func BuildFromConfig added in v1.7.0

func BuildFromConfig(d *daemon.Daemon, c *runconfig.Config, changes []string) (*runconfig.Config, error)

BuildFromConfig will do build directly from parameter 'changes', which comes from Dockerfile entries, it will:

- call parse.Parse() to get AST root from Dockerfile entries - do build by calling builder.dispatch() to call all entries' handling routines

func Commit added in v1.7.0

func Commit(name string, d *daemon.Daemon, c *CommitConfig) (string, error)

Commit will create a new image from a container's changes

func ProcessWord added in v1.6.0

func ProcessWord(word string, env []string) (string, error)

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

Types

type BFlags added in v1.8.0

type BFlags struct {
	Args []string // actual flags/args from cmd line

	Err error
	// contains filtered or unexported fields
}

BFlags contains all flags information for the builder

func NewBFlags added in v1.8.0

func NewBFlags() *BFlags

NewBFlags return the new BFlags struct

func (*BFlags) AddBool added in v1.8.0

func (bf *BFlags) AddBool(name string, def bool) *Flag

AddBool adds a bool flag to BFlags

func (*BFlags) AddString added in v1.8.0

func (bf *BFlags) AddString(name string, def string) *Flag

AddString adds a string flag to BFlags

func (*BFlags) Parse added in v1.8.0

func (bf *BFlags) Parse() error

Parse parses and checks if the BFlags is valid

type CommitConfig added in v1.8.0

type CommitConfig struct {
	Pause   bool
	Repo    string
	Tag     string
	Author  string
	Comment string
	Changes []string
	Config  *runconfig.Config
}

CommitConfig contains build configs for commit operation

type Config added in v1.7.0

type Config struct {
	DockerfileName string
	RemoteURL      string
	RepoName       string
	SuppressOutput bool
	NoCache        bool
	Remove         bool
	ForceRemove    bool
	Pull           bool
	Memory         int64
	MemorySwap     int64
	CPUShares      int64
	CPUPeriod      int64
	CPUQuota       int64
	CPUSetCpus     string
	CPUSetMems     string
	CgroupParent   string
	Ulimits        []*ulimit.Ulimit
	AuthConfigs    map[string]cliconfig.AuthConfig

	Stdout  io.Writer
	Context io.ReadCloser
	// contains filtered or unexported fields
}

Config contains all configs for a build job

func NewBuildConfig added in v1.7.0

func NewBuildConfig() *Config

NewBuildConfig returns a new Config struct

func (*Config) Cancel added in v1.7.0

func (b *Config) Cancel()

Cancel signals the build job to cancel

func (*Config) WaitCancelled added in v1.7.0

func (b *Config) WaitCancelled() <-chan struct{}

WaitCancelled returns a channel which is closed ("never blocks") when the job is cancelled.

type Flag added in v1.7.0

type Flag struct {
	Value string
	// contains filtered or unexported fields
}

Flag contains all information for a flag

func (*Flag) IsTrue added in v1.7.0

func (fl *Flag) IsTrue() bool

IsTrue checks if a bool flag is true

func (*Flag) IsUsed added in v1.7.0

func (fl *Flag) IsUsed() bool

IsUsed checks if the flag is used

type FlagType added in v1.7.0

type FlagType int

FlagType is the type of the build flag

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