{"modulePath":"github.com/hyperhq/hypercli","version":"v1.10.16","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package dockerfile\n\nPackage dockerfile is the evaluation step in the Dockerfile parse/evaluate pipeline.\n\nIt 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.\n\nPlease 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.\n\nONBUILD is a special case, which is covered in the onbuild() func in dispatchers.go.\n\nThe 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).\n\n## Variables\n\n```go\nvar BuiltinAllowedBuildArgs = map[string]bool{\n\t\"HTTP_PROXY\":  true,\n\t\"http_proxy\":  true,\n\t\"HTTPS_PROXY\": true,\n\t\"https_proxy\": true,\n\t\"FTP_PROXY\":   true,\n\t\"ftp_proxy\":   true,\n\t\"NO_PROXY\":    true,\n\t\"no_proxy\":    true,\n}\n```\nBuiltinAllowedBuildArgs is list of built-in allowed build args\n\n## Functions\n\n```go\nfunc BuildFromConfig(config *container.Config, changes []string) (*container.Config, error)\n```\nBuildFromConfig 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\n\nBuildFromConfig is used by the /commit endpoint, with the changes coming from the query parameter of the same name.\n\nTODO: Remove?\n\n```go\nfunc ProcessWord(word string, env []string) (string, error)\n```\nProcessWord will use the 'env' list of environment variables, and replace any env var references in 'word'.\n\n```go\nfunc ProcessWords(word string, env []string) ([]string, error)\n```\nProcessWords 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.\n\n## Types\n\n```go\ntype BFlags struct {\n\tArgs []string // actual flags/args from cmd line\n\n\tErr error\n\t// contains filtered or unexported fields\n}\n```\nBFlags contains all flags information for the builder\n\n```go\nfunc NewBFlags() *BFlags\n```\nNewBFlags return the new BFlags struct\n\n```go\nfunc (bf *BFlags) AddBool(name string, def bool) *Flag\n```\nAddBool adds a bool flag to BFlags Note, any error will be generated when Parse() is called (see Parse).\n\n```go\nfunc (bf *BFlags) AddString(name string, def string) *Flag\n```\nAddString adds a string flag to BFlags Note, any error will be generated when Parse() is called (see Parse).\n\n```go\nfunc (bf *BFlags) Parse() error\n```\nParse 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:\n\n\tdefFlag := AddString(\"description\", \"\")\n\nw/o needing to add an if-statement around each one.\n\n```go\ntype BuildManager struct {\n\t// contains filtered or unexported fields\n}\n```\nBuildManager implements builder.Backend and is shared across all Builder objects.\n\n```go\nfunc NewBuildManager(b builder.Backend) (bm *BuildManager)\n```\nNewBuildManager creates a BuildManager.\n\n```go\nfunc (bm *BuildManager) Build(config *types.ImageBuildOptions, context builder.Context, stdout io.Writer, stderr io.Writer, out io.Writer, clientGone \u003c-chan bool) (string, error)\n```\nBuild creates a NewBuilder, which builds the image.\n\n```go\ntype Builder struct {\n\tStdout io.Writer\n\tStderr io.Writer\n\tOutput io.Writer\n\t// contains filtered or unexported fields\n}\n```\nBuilder is a Dockerfile builder It implements the builder.Backend interface.\n\n```go\nfunc NewBuilder(config *types.ImageBuildOptions, backend builder.Backend, context builder.Context, dockerfile io.ReadCloser) (b *Builder, err error)\n```\nNewBuilder creates a new Dockerfile builder from an optional dockerfile and a Config. If dockerfile is nil, the Dockerfile specified by Config.DockerfileName, will be read from the Context passed to Build().\n\n```go\nfunc (b *Builder) Cancel()\n```\nCancel cancels an ongoing Dockerfile build.\n\n```go\ntype Flag struct {\n\tValue string\n\t// contains filtered or unexported fields\n}\n```\nFlag contains all information for a flag\n\n```go\nfunc (fl *Flag) IsTrue() bool\n```\nIsTrue checks if a bool flag is true\n\n```go\nfunc (fl *Flag) IsUsed() bool\n```\nIsUsed checks if the flag is used\n\n```go\ntype FlagType int\n```\nFlagType is the type of the build flag\n\n","path":"github.com/hyperhq/hypercli/builder/dockerfile","name":"dockerfile","synopsis":"Package dockerfile is the evaluation step in the Dockerfile parse/evaluate pipeline.","isRedistributable":true}
