diff --git a/frontend/dockerfile/command/command.go b/frontend/dockerfile/command/command.go index 3e087e42..f23c6874 100644 --- a/frontend/dockerfile/command/command.go +++ b/frontend/dockerfile/command/command.go @@ -3,42 +3,44 @@ package command // Define constants for the command strings const ( + Add = "add" + Arg = "arg" + Cmd = "cmd" + Copy = "copy" + Entrypoint = "entrypoint" Env = "env" + Expose = "expose" + From = "from" + Healthcheck = "healthcheck" Label = "label" Maintainer = "maintainer" - Add = "add" - Copy = "copy" - From = "from" Onbuild = "onbuild" - Workdir = "workdir" Run = "run" - Cmd = "cmd" - Entrypoint = "entrypoint" - Expose = "expose" - Volume = "volume" - User = "user" + Shell = "shell" StopSignal = "stopsignal" - Arg = "arg" - Healthcheck = "healthcheck" + User = "user" + Volume = "volume" + Workdir = "workdir" ) // Commands is list of all Dockerfile commands var Commands = map[string]struct{}{ + Add: {}, + Arg: {}, + Cmd: {}, + Copy: {}, + Entrypoint: {}, Env: {}, + Expose: {}, + From: {}, + Healthcheck: {}, Label: {}, Maintainer: {}, - Add: {}, - Copy: {}, - From: {}, Onbuild: {}, - Workdir: {}, Run: {}, - Cmd: {}, - Entrypoint: {}, - Expose: {}, - Volume: {}, - User: {}, + Shell: {}, StopSignal: {}, - Arg: {}, - Healthcheck: {}, + User: {}, + Volume: {}, + Workdir: {}, } diff --git a/frontend/dockerfile/parser/parser.go b/frontend/dockerfile/parser/parser.go index 48aee991..5a61a9d4 100644 --- a/frontend/dockerfile/parser/parser.go +++ b/frontend/dockerfile/parser/parser.go @@ -67,23 +67,24 @@ func init() { // functions. Errors are propagated up by Parse() and the resulting AST can // be incorporated directly into the existing AST as a next. dispatch = map[string]func(string) (*Node, map[string]bool, error){ - command.User: parseString, - command.Onbuild: parseSubCommand, - command.Workdir: parseString, + command.Add: parseMaybeJSONToList, + command.Arg: parseNameOrNameVal, + command.Cmd: parseMaybeJSON, + command.Copy: parseMaybeJSONToList, + command.Entrypoint: parseMaybeJSON, command.Env: parseEnv, + command.Expose: parseStringsWhitespaceDelimited, + command.From: parseString, + command.Healthcheck: parseHealthConfig, command.Label: parseLabel, command.Maintainer: parseString, - command.From: parseString, - command.Add: parseMaybeJSONToList, - command.Copy: parseMaybeJSONToList, + command.Onbuild: parseSubCommand, command.Run: parseMaybeJSON, - command.Cmd: parseMaybeJSON, - command.Entrypoint: parseMaybeJSON, - command.Expose: parseStringsWhitespaceDelimited, - command.Volume: parseMaybeJSONToList, + command.Shell: parseMaybeJSON, command.StopSignal: parseString, - command.Arg: parseNameOrNameVal, - command.Healthcheck: parseHealthConfig, + command.User: parseString, + command.Volume: parseMaybeJSONToList, + command.Workdir: parseString, } }