Documentation ¶
Overview ¶
Package dockerfile implements a minimal dockerfile parser.
Index ¶
Constants ¶
const VarMeta = '$'
VarMeta is the metacharacter for variables. It's not configurable.
Variables ¶
This section is empty.
Functions ¶
func GetLabels ¶
GetLabels parses the Dockerfile in the provided Reader and returns all discovered labels as provided by the LABEL instruction, with variables resolved and expanded.
ARG and ENV instructions are understood. This will yield different results if a build argument is supplied at build time.
Types ¶
type Unquote ¶
type Unquote struct {
// contains filtered or unexported fields
}
Unquote is a text transformer that undoes one level of quoting.
It does not enforce that the entire text passed to the Transform method is a valid quoted string; leading or trailing characters or multiple consecutive quoted strings are fine.
Any unrecognized escape pairs are passed through unchanged. Multicharacter escape sequences like "\xNN" or "\NNN" or "\uNNNN" are unsupported.
func NewUnquote ¶
func NewUnquote() *Unquote
NewUnquote returns an Unquote ready to use with the escape metacharacter set to '\'.
type Vars ¶
type Vars struct {
// contains filtered or unexported fields
}
Vars is a text transformer that does variable expansion as described in the Dockerfile Reference document.
It supports POSIX sh-like expansions but not in the general forms, only the ":-" (expand if unset) and ":+" (expand if set) versions.
The transformation algorithm uses an escape metacharacter in front of the variable metacharacter to allow a literal metacharacter to be passed through. Any unrecognized escapes are passed through unmodified.
func NewVars ¶
func NewVars() *Vars
NewVars returns a Vars with the metacharacter set to '\' and no variables defined.
func (*Vars) Escape ¶
Escape changes the escape metacharacter.
This is possible to do at any time, but may be inadvisable.
func (*Vars) Reset ¶
func (v *Vars) Reset()
Reset implements transform.Transformer.
This method does not reset calls to Set. Use Clear to reset stored variable expansions.