Documentation ¶
Overview ¶
Package builder uses code from github.com/docker/docker/builder/* to implement a Docker builder that does not create individual layers, but instead creates a single layer.
TODO: full windows support
Index ¶
- Constants
- Variables
- func BashQuote(env string) string
- func ExportEnv(env []string) string
- func ParseDockerfile(r io.Reader) (*parser.Node, error)
- func ParseDockerignore(root string) ([]string, error)
- func ParseFile(path string) (*parser.Node, error)
- func ProcessWord(word string, env []string) (string, error)
- func ProcessWords(word string, env []string) ([]string, error)
- func SplitBy(node *parser.Node, value string) []*parser.Node
- func SplitChildren(node *parser.Node, value string) []*parser.Node
- type Builder
- func (b *Builder) Arguments() []string
- func (b *Builder) Config() *docker.Config
- func (b *Builder) From(node *parser.Node) (string, error)
- func (b *Builder) FromImage(image *docker.Image, node *parser.Node) error
- func (b *Builder) RequiresStart(node *parser.Node) bool
- func (b *Builder) Run(step *Step, exec Executor, noRunsRemaining bool) error
- func (b *Builder) Step() *Step
- type Copy
- type Executor
- type Run
- type Stage
- type Stages
- type Step
- type StepFunc
- type VolumeSet
Constants ¶
const (
// in docker/system
NoBaseImageSpecifier = "scratch"
)
Variables ¶
var ( LogExecutor = logExecutor{} NoopExecutor = noopExecutor{} )
var ErrNoFROM = fmt.Errorf("no FROM statement found")
ErrNoFROM is returned if the Dockerfile did not contain a FROM statement.
Functions ¶
func BashQuote ¶
BashQuote escapes the provided string and surrounds it with double quotes. TODO: verify that these are all we have to escape.
func ExportEnv ¶
ExportEnv creates an export statement for a shell that contains all of the provided environment.
func ParseDockerfile ¶
ParseDockerfile parses the provided stream as a canonical Dockerfile
func ParseDockerignore ¶
ParseDockerIgnore returns a list of the excludes in the .dockerignore file. extracted from fsouza/go-dockerclient.
func ProcessWord ¶
ProcessWord will use the 'env' list of environment variables, and replace any env var references in 'word'.
func ProcessWords ¶
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.
Types ¶
type Builder ¶
type Builder struct { RunConfig docker.Config Env []string Args map[string]string CmdSet bool Author string AllowedArgs map[string]bool Volumes VolumeSet Excludes []string PendingVolumes VolumeSet PendingRuns []Run PendingCopies []Copy Warnings []string }
func NewBuilder ¶
func (*Builder) Config ¶
Config returns a snapshot of the current RunConfig intended for use with a container commit.
func (*Builder) From ¶
From returns the image this dockerfile depends on, or an error if no FROM is found or if multiple FROM are specified. If a single from is found the passed node is updated with only the remaining statements. The builder's RunConfig.Image field is set to the first From found, or left unchanged if already set.
func (*Builder) FromImage ¶
FromImage updates the builder to use the provided image (resetting RunConfig and recording the image environment), and updates the node with any ONBUILD statements extracted from the parent image.
func (*Builder) RequiresStart ¶
RequiresStart returns true if a running container environment is necessary to invoke the provided commands
type Copy ¶
type Copy struct { // If true, this is a copy from the file system to the container. If false, // the copy is from the context. FromFS bool // If set, this is a copy from the named stage or image to the container. From string Src []string Dest string Download bool // If set, the owner:group for the destination. This value is passed // to the executor for handling. Chown string }
Copy defines a copy operation required on the container.
type Step ¶
type Step struct { Env []string Command string Args []string Flags []string Attrs map[string]bool Message string Original string }
Step represents the input Env and the output command after all post processing of the command arguments is done.
func (*Step) Resolve ¶
Resolve transforms a parsed Dockerfile line into a command to execute, resolving any arguments.
Almost all nodes will have this structure: Child[Node, Node, Node] where Child is from parser.Node.Children and each node comes from parser.Node.Next. This forms a "line" with a statement and arguments and we process them in this normalized form by hitting evaluateTable with the leaf nodes of the command and the Builder object.
ONBUILD is a special case; in this case the parser will emit: Child[Node, Child[Node, Node...]] where the first node is the literal "onbuild" and the child entrypoint is the command of the ONBUILD statement, such as `RUN` in ONBUILD RUN foo. There is special case logic in here to deal with that, at least until it becomes more of a general concern with new features.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package signal provides helper functions for dealing with signals across various operating systems.
|
Package signal provides helper functions for dealing with signals across various operating systems. |