Documentation ¶
Index ¶
- func HasStage(s []Stage, name string) (int, bool)
- func IsCurrentStage(s []Stage, name string) bool
- func IsUnknownInstruction(err error) bool
- func Parse(ast *parser.Node) (stages []Stage, metaArgs []ArgCommand, err error)
- func ParseInstruction(node *parser.Node) (interface{}, error)
- type AddCommand
- type ArgCommand
- type BFlags
- type CmdCommand
- type Command
- type CopyCommand
- type EntrypointCommand
- type EnvCommand
- type ExposeCommand
- type Flag
- type FlagType
- type HealthCheckCommand
- type KeyValuePair
- type KeyValuePairs
- type LabelCommand
- type MaintainerCommand
- type OnbuildCommand
- type PlatformSpecific
- type RunCommand
- type ShellCommand
- type ShellDependantCmdLine
- type SingleWordExpander
- type SourcesAndDest
- type Stage
- type StopSignalCommand
- type SupportsSingleWordExpansion
- type UnknownInstruction
- type UserCommand
- type VolumeCommand
- type WorkdirCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsCurrentStage ¶
IsCurrentStage check if the stage name is the current stage
func IsUnknownInstruction ¶
IsUnknownInstruction checks if the error is an UnknownInstruction or a parseError containing an UnknownInstruction
func Parse ¶
func Parse(ast *parser.Node) (stages []Stage, metaArgs []ArgCommand, err error)
Parse a docker file into a collection of buildable stages
func ParseInstruction ¶
ParseInstruction converts an AST to a typed instruction (either a command or a build stage beginning when encountering a `FROM` statement)
Types ¶
type AddCommand ¶
type AddCommand struct { SourcesAndDest Chown string // contains filtered or unexported fields }
AddCommand : ADD foo /path
Add the file 'foo' to '/path'. Tarball and Remote URL (git, http) handling exist here. If you do not wish to have this automatic handling, use COPY.
func (*AddCommand) Expand ¶
func (c *AddCommand) Expand(expander SingleWordExpander) error
Expand variables
type ArgCommand ¶
ArgCommand : ARG name[=value]
Adds the variable foo to the trusted list of variables that can be passed to builder using the --build-arg flag for expansion/substitution or passing to 'run'. Dockerfile author may optionally set a default value of this variable.
func (*ArgCommand) Expand ¶
func (c *ArgCommand) Expand(expander SingleWordExpander) error
Expand variables
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 NewBFlagsWithArgs ¶
NewBFlagsWithArgs returns the new BFlags struct with Args set to args
func (*BFlags) AddBool ¶
AddBool adds a bool flag to BFlags Note, any error will be generated when Parse() is called (see Parse).
func (*BFlags) AddString ¶
AddString adds a string flag to BFlags Note, any error will be generated when Parse() is called (see Parse).
func (*BFlags) Parse ¶
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 CmdCommand ¶
type CmdCommand struct { ShellDependantCmdLine // contains filtered or unexported fields }
CmdCommand : CMD foo
Set the default command to run in the container (which may be empty). Argument handling is the same as RUN.
type Command ¶
type Command interface {
Name() string
}
Command is implemented by every command present in a dockerfile
type CopyCommand ¶
type CopyCommand struct { SourcesAndDest From string Chown string // contains filtered or unexported fields }
CopyCommand : COPY foo /path
Same as 'ADD' but without the tar and remote url handling.
func (*CopyCommand) Expand ¶
func (c *CopyCommand) Expand(expander SingleWordExpander) error
Expand variables
type EntrypointCommand ¶
type EntrypointCommand struct { ShellDependantCmdLine // contains filtered or unexported fields }
EntrypointCommand : ENTRYPOINT /usr/sbin/nginx
Set the entrypoint to /usr/sbin/nginx. Will accept the CMD as the arguments to /usr/sbin/nginx. Uses the default shell if not in JSON format.
Handles command processing similar to CMD and RUN, only req.runConfig.Entrypoint is initialized at newBuilder time instead of through argument parsing.
type EnvCommand ¶
type EnvCommand struct { Env KeyValuePairs // kvp slice instead of map to preserve ordering // contains filtered or unexported fields }
EnvCommand : ENV key1 value1 [keyN valueN...]
func (*EnvCommand) Expand ¶
func (c *EnvCommand) Expand(expander SingleWordExpander) error
Expand variables
type ExposeCommand ¶
type ExposeCommand struct { Ports []string // contains filtered or unexported fields }
ExposeCommand : EXPOSE 6667/tcp 7000/tcp
Expose ports for links and port mappings. This all ends up in req.runConfig.ExposedPorts for runconfig.
type Flag ¶
type Flag struct { Value string // contains filtered or unexported fields }
Flag contains all information for a flag
type HealthCheckCommand ¶
type HealthCheckCommand struct { Health *container.HealthConfig // contains filtered or unexported fields }
HealthCheckCommand : HEALTHCHECK foo
Set the default healthcheck command to run in the container (which may be empty). Argument handling is the same as RUN.
type KeyValuePair ¶
KeyValuePair represent an arbitrary named value (useful in slice instead of map[string] string to preserve ordering)
func (*KeyValuePair) String ¶
func (kvp *KeyValuePair) String() string
type LabelCommand ¶
type LabelCommand struct { Labels KeyValuePairs // kvp slice instead of map to preserve ordering // contains filtered or unexported fields }
LabelCommand : LABEL some json data describing the image
Sets the Label variable foo to bar,
func (*LabelCommand) Expand ¶
func (c *LabelCommand) Expand(expander SingleWordExpander) error
Expand variables
type MaintainerCommand ¶
type MaintainerCommand struct { Maintainer string // contains filtered or unexported fields }
MaintainerCommand : MAINTAINER maintainer_name
type OnbuildCommand ¶
type OnbuildCommand struct { Expression string // contains filtered or unexported fields }
OnbuildCommand : ONBUILD <some other command>
type PlatformSpecific ¶
PlatformSpecific adds platform checks to a command
type RunCommand ¶
type RunCommand struct { ShellDependantCmdLine // contains filtered or unexported fields }
RunCommand : RUN some command yo
run a command and commit the image. Args are automatically prepended with the current SHELL which defaults to 'sh -c' under linux or 'cmd /S /C' under Windows, in the event there is only one argument The difference in processing:
RUN echo hi # sh -c echo hi (Linux) RUN echo hi # cmd /S /C echo hi (Windows) RUN [ "echo", "hi" ] # echo hi
type ShellDependantCmdLine ¶
ShellDependantCmdLine represents a cmdline optionally prepended with the shell
type SingleWordExpander ¶
SingleWordExpander is a provider for variable expansion where 1 word => 1 output
type SourcesAndDest ¶
type SourcesAndDest []string
SourcesAndDest represent a list of source files and a destination
func (SourcesAndDest) Sources ¶
func (s SourcesAndDest) Sources() []string
Sources list the source paths
type Stage ¶
type Stage struct { Name string Commands []Command BaseName string SourceCode string Platform specs.Platform }
Stage represents a single stage in a multi-stage build
func CurrentStage ¶
CurrentStage return the last stage in a slice
type StopSignalCommand ¶
type StopSignalCommand struct { Signal string // contains filtered or unexported fields }
StopSignalCommand : STOPSIGNAL signal
Set the signal that will be used to kill the container.
func (*StopSignalCommand) CheckPlatform ¶
func (c *StopSignalCommand) CheckPlatform(platform string) error
CheckPlatform checks that the command is supported in the target platform
func (*StopSignalCommand) Expand ¶
func (c *StopSignalCommand) Expand(expander SingleWordExpander) error
Expand variables
type SupportsSingleWordExpansion ¶
type SupportsSingleWordExpansion interface {
Expand(expander SingleWordExpander) error
}
SupportsSingleWordExpansion interface marks a command as supporting variable expansion
type UnknownInstruction ¶
UnknownInstruction represents an error occurring when a command is unresolvable
func (*UnknownInstruction) Error ¶
func (e *UnknownInstruction) Error() string
type UserCommand ¶
type UserCommand struct { User string // contains filtered or unexported fields }
UserCommand : USER foo
Set the user to 'foo' for future commands and when running the ENTRYPOINT/CMD at container run time.
func (*UserCommand) Expand ¶
func (c *UserCommand) Expand(expander SingleWordExpander) error
Expand variables
type VolumeCommand ¶
type VolumeCommand struct { Volumes []string // contains filtered or unexported fields }
VolumeCommand : VOLUME /foo
Expose the volume /foo for use. Will also accept the JSON array form.
func (*VolumeCommand) Expand ¶
func (c *VolumeCommand) Expand(expander SingleWordExpander) error
Expand variables
type WorkdirCommand ¶
type WorkdirCommand struct { Path string // contains filtered or unexported fields }
WorkdirCommand : WORKDIR /tmp
Set the working directory for future RUN/CMD/etc statements.
func (*WorkdirCommand) Expand ¶
func (c *WorkdirCommand) Expand(expander SingleWordExpander) error
Expand variables