Builder default shell

Signed-off-by: John Howard <jhoward@microsoft.com>

rewritten from github.com/moby/moby b18ae8c9ccc2eb6cf8aa947f25eb6f1d20089776
docker-18.09
John Howard 2016-05-03 13:56:59 -07:00 committed by Tonis Tiigi
parent ed9a858fdd
commit 64323d3df2
2 changed files with 37 additions and 34 deletions

View File

@ -3,42 +3,44 @@ package command
// Define constants for the command strings // Define constants for the command strings
const ( const (
Add = "add"
Arg = "arg"
Cmd = "cmd"
Copy = "copy"
Entrypoint = "entrypoint"
Env = "env" Env = "env"
Expose = "expose"
From = "from"
Healthcheck = "healthcheck"
Label = "label" Label = "label"
Maintainer = "maintainer" Maintainer = "maintainer"
Add = "add"
Copy = "copy"
From = "from"
Onbuild = "onbuild" Onbuild = "onbuild"
Workdir = "workdir"
Run = "run" Run = "run"
Cmd = "cmd" Shell = "shell"
Entrypoint = "entrypoint"
Expose = "expose"
Volume = "volume"
User = "user"
StopSignal = "stopsignal" StopSignal = "stopsignal"
Arg = "arg" User = "user"
Healthcheck = "healthcheck" Volume = "volume"
Workdir = "workdir"
) )
// Commands is list of all Dockerfile commands // Commands is list of all Dockerfile commands
var Commands = map[string]struct{}{ var Commands = map[string]struct{}{
Add: {},
Arg: {},
Cmd: {},
Copy: {},
Entrypoint: {},
Env: {}, Env: {},
Expose: {},
From: {},
Healthcheck: {},
Label: {}, Label: {},
Maintainer: {}, Maintainer: {},
Add: {},
Copy: {},
From: {},
Onbuild: {}, Onbuild: {},
Workdir: {},
Run: {}, Run: {},
Cmd: {}, Shell: {},
Entrypoint: {},
Expose: {},
Volume: {},
User: {},
StopSignal: {}, StopSignal: {},
Arg: {}, User: {},
Healthcheck: {}, Volume: {},
Workdir: {},
} }

View File

@ -67,23 +67,24 @@ func init() {
// functions. Errors are propagated up by Parse() and the resulting AST can // functions. Errors are propagated up by Parse() and the resulting AST can
// be incorporated directly into the existing AST as a next. // be incorporated directly into the existing AST as a next.
dispatch = map[string]func(string) (*Node, map[string]bool, error){ dispatch = map[string]func(string) (*Node, map[string]bool, error){
command.User: parseString, command.Add: parseMaybeJSONToList,
command.Onbuild: parseSubCommand, command.Arg: parseNameOrNameVal,
command.Workdir: parseString, command.Cmd: parseMaybeJSON,
command.Copy: parseMaybeJSONToList,
command.Entrypoint: parseMaybeJSON,
command.Env: parseEnv, command.Env: parseEnv,
command.Expose: parseStringsWhitespaceDelimited,
command.From: parseString,
command.Healthcheck: parseHealthConfig,
command.Label: parseLabel, command.Label: parseLabel,
command.Maintainer: parseString, command.Maintainer: parseString,
command.From: parseString, command.Onbuild: parseSubCommand,
command.Add: parseMaybeJSONToList,
command.Copy: parseMaybeJSONToList,
command.Run: parseMaybeJSON, command.Run: parseMaybeJSON,
command.Cmd: parseMaybeJSON, command.Shell: parseMaybeJSON,
command.Entrypoint: parseMaybeJSON,
command.Expose: parseStringsWhitespaceDelimited,
command.Volume: parseMaybeJSONToList,
command.StopSignal: parseString, command.StopSignal: parseString,
command.Arg: parseNameOrNameVal, command.User: parseString,
command.Healthcheck: parseHealthConfig, command.Volume: parseMaybeJSONToList,
command.Workdir: parseString,
} }
} }