|
@@ -30,7 +30,7 @@ const (
|
|
|
)
|
|
|
|
|
|
// dispatch with no layer / parsing. This is effectively not a command.
|
|
|
-func nullDispatch(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func nullDispatch(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
@@ -39,7 +39,7 @@ func nullDispatch(b *Builder, args []string, attributes map[string]bool, origina
|
|
|
// Sets the environment variable foo to bar, also makes interpolation
|
|
|
// in the dockerfile available from the next statement on via ${foo}.
|
|
|
//
|
|
|
-func env(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func env(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) == 0 {
|
|
|
return fmt.Errorf("ENV requires at least one argument")
|
|
|
}
|
|
@@ -98,7 +98,7 @@ func env(b *Builder, args []string, attributes map[string]bool, original string)
|
|
|
// MAINTAINER some text <maybe@an.email.address>
|
|
|
//
|
|
|
// Sets the maintainer metadata.
|
|
|
-func maintainer(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func maintainer(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) != 1 {
|
|
|
return fmt.Errorf("MAINTAINER requires exactly one argument")
|
|
|
}
|
|
@@ -115,7 +115,7 @@ func maintainer(b *Builder, args []string, attributes map[string]bool, original
|
|
|
//
|
|
|
// Sets the Label variable foo to bar,
|
|
|
//
|
|
|
-func label(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func label(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) == 0 {
|
|
|
return fmt.Errorf("LABEL requires at least one argument")
|
|
|
}
|
|
@@ -151,7 +151,7 @@ func label(b *Builder, args []string, attributes map[string]bool, original strin
|
|
|
// 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 add(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func add(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) < 2 {
|
|
|
return fmt.Errorf("ADD requires at least two arguments")
|
|
|
}
|
|
@@ -167,7 +167,7 @@ func add(b *Builder, args []string, attributes map[string]bool, original string)
|
|
|
//
|
|
|
// Same as 'ADD' but without the tar and remote url handling.
|
|
|
//
|
|
|
-func dispatchCopy(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func dispatchCopy(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) < 2 {
|
|
|
return fmt.Errorf("COPY requires at least two arguments")
|
|
|
}
|
|
@@ -183,7 +183,7 @@ func dispatchCopy(b *Builder, args []string, attributes map[string]bool, origina
|
|
|
//
|
|
|
// This sets the image the dockerfile will build on top of.
|
|
|
//
|
|
|
-func from(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func from(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) != 1 {
|
|
|
return fmt.Errorf("FROM requires one argument")
|
|
|
}
|
|
@@ -231,7 +231,7 @@ func from(b *Builder, args []string, attributes map[string]bool, original string
|
|
|
// special cases. search for 'OnBuild' in internals.go for additional special
|
|
|
// cases.
|
|
|
//
|
|
|
-func onbuild(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func onbuild(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) == 0 {
|
|
|
return fmt.Errorf("ONBUILD requires at least one argument")
|
|
|
}
|
|
@@ -258,7 +258,7 @@ func onbuild(b *Builder, args []string, attributes map[string]bool, original str
|
|
|
//
|
|
|
// Set the working directory for future RUN/CMD/etc statements.
|
|
|
//
|
|
|
-func workdir(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func workdir(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if len(args) != 1 {
|
|
|
return fmt.Errorf("WORKDIR requires exactly one argument")
|
|
|
}
|
|
@@ -315,7 +315,7 @@ func workdir(b *Builder, args []string, attributes map[string]bool, original str
|
|
|
// RUN echo hi # cmd /S /C echo hi (Windows)
|
|
|
// RUN [ "echo", "hi" ] # echo hi
|
|
|
//
|
|
|
-func run(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func run(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if b.image == "" && !b.noBaseImage {
|
|
|
return fmt.Errorf("Please provide a source image with `from` prior to run")
|
|
|
}
|
|
@@ -324,7 +324,7 @@ func run(b *Builder, args []string, attributes map[string]bool, original string)
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- args = handleJsonArgs(args, attributes)
|
|
|
+ args = handleJSONArgs(args, attributes)
|
|
|
|
|
|
if !attributes["json"] {
|
|
|
if runtime.GOOS != "windows" {
|
|
@@ -386,12 +386,12 @@ func run(b *Builder, args []string, attributes map[string]bool, original string)
|
|
|
// Set the default command to run in the container (which may be empty).
|
|
|
// Argument handling is the same as RUN.
|
|
|
//
|
|
|
-func cmd(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func cmd(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if err := b.BuilderFlags.Parse(); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- cmdSlice := handleJsonArgs(args, attributes)
|
|
|
+ cmdSlice := handleJSONArgs(args, attributes)
|
|
|
|
|
|
if !attributes["json"] {
|
|
|
if runtime.GOOS != "windows" {
|
|
@@ -422,12 +422,12 @@ func cmd(b *Builder, args []string, attributes map[string]bool, original string)
|
|
|
// Handles command processing similar to CMD and RUN, only b.Config.Entrypoint
|
|
|
// is initialized at NewBuilder time instead of through argument parsing.
|
|
|
//
|
|
|
-func entrypoint(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func entrypoint(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if err := b.BuilderFlags.Parse(); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- parsed := handleJsonArgs(args, attributes)
|
|
|
+ parsed := handleJSONArgs(args, attributes)
|
|
|
|
|
|
switch {
|
|
|
case attributes["json"]:
|
|
@@ -463,7 +463,7 @@ func entrypoint(b *Builder, args []string, attributes map[string]bool, original
|
|
|
// Expose ports for links and port mappings. This all ends up in
|
|
|
// b.Config.ExposedPorts for runconfig.
|
|
|
//
|
|
|
-func expose(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func expose(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
portsTab := args
|
|
|
|
|
|
if len(args) == 0 {
|
|
@@ -504,9 +504,9 @@ func expose(b *Builder, args []string, attributes map[string]bool, original stri
|
|
|
// Set the user to 'foo' for future commands and when running the
|
|
|
// ENTRYPOINT/CMD at container run time.
|
|
|
//
|
|
|
-func user(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func user(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if runtime.GOOS == "windows" {
|
|
|
- return fmt.Errorf("USER is not supported on Windows.")
|
|
|
+ return fmt.Errorf("USER is not supported on Windows")
|
|
|
}
|
|
|
|
|
|
if len(args) != 1 {
|
|
@@ -525,9 +525,9 @@ func user(b *Builder, args []string, attributes map[string]bool, original string
|
|
|
//
|
|
|
// Expose the volume /foo for use. Will also accept the JSON array form.
|
|
|
//
|
|
|
-func volume(b *Builder, args []string, attributes map[string]bool, original string) error {
|
|
|
+func volume(b *builder, args []string, attributes map[string]bool, original string) error {
|
|
|
if runtime.GOOS == "windows" {
|
|
|
- return fmt.Errorf("VOLUME is not supported on Windows.")
|
|
|
+ return fmt.Errorf("VOLUME is not supported on Windows")
|
|
|
}
|
|
|
if len(args) == 0 {
|
|
|
return fmt.Errorf("VOLUME requires at least one argument")
|