dockerfile

package
v0.6.3-0...-140fefd Latest Latest
Warning

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

Go to latest
Published: May 4, 2017 License: Apache-2.0 Imports: 43 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 BFlags

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

func NewBFlags() *BFlags

NewBFlags returns the new BFlags struct

func NewBFlagsWithArgs

func NewBFlagsWithArgs(args []string) *BFlags

NewBFlagsWithArgs returns the new BFlags struct with Args set to args

func (*BFlags) AddBool

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

AddBool adds a bool flag to BFlags Note, any error will be generated when Parse() is called (see Parse).

func (*BFlags) AddString

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

AddString adds a string flag to BFlags Note, any error will be generated when Parse() is called (see Parse).

func (*BFlags) Parse

func (bf *BFlags) Parse() error

Parse parses and checks if the BFlags is valid. Any error noticed during the AddXXX() funcs will be generated/returned here. We do this because an error during AddXXX() is more like a compile time error so it doesn't matter too much when we stop our processing as long as we do stop it, so this allows the code around AddXXX() to be just:

defFlag := AddString("description", "")

w/o needing to add an if-statement around each one.

type BuildManager

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

BuildManager is shared across all Builder objects

func NewBuildManager

func NewBuildManager(b builder.Backend) *BuildManager

NewBuildManager creates a BuildManager

func (*BuildManager) Build

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
	Output io.Writer
	// contains filtered or unexported fields
}

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

type Flag

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

Flag contains all information for a flag

func (*Flag) IsTrue

func (fl *Flag) IsTrue() bool

IsTrue checks if a bool flag is true

func (*Flag) IsUsed

func (fl *Flag) IsUsed() bool

IsUsed checks if the flag is used

type FlagType

type FlagType int

FlagType is the type of the build flag

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