diff --git a/cmd/drone-docker/main.go b/cmd/drone-docker/main.go index 712ace4..946d994 100644 --- a/cmd/drone-docker/main.go +++ b/cmd/drone-docker/main.go @@ -223,6 +223,11 @@ func main() { Usage: "do not use cached intermediate containers", EnvVar: "PLUGIN_NO_CACHE", }, + cli.StringSliceFlag{ + Name: "add-host", + Usage: "additional host:IP mapping", + EnvVar: "PLUGIN_ADD_HOST", + }, } if err := app.Run(os.Args); err != nil { @@ -257,6 +262,7 @@ func run(c *cli.Context) error { Labels: c.StringSlice("custom-labels"), LabelSchema: c.StringSlice("label-schema"), NoCache: c.Bool("no-cache"), + AddHost: c.StringSlice("add-host"), }, Daemon: docker.Daemon{ Registry: c.String("docker.registry"), diff --git a/docker.go b/docker.go index 9c2a136..be23616 100644 --- a/docker.go +++ b/docker.go @@ -52,6 +52,7 @@ type ( LabelSchema []string // label-schema Label map Labels []string // Label map NoCache bool // Docker build no-cache + AddHost []string // Docker build add-host } // Plugin defines the Docker plugin parameters. @@ -215,6 +216,9 @@ func commandBuild(build Build) *exec.Cmd { for _, arg := range build.Args { args = append(args, "--build-arg", arg) } + for _, host := range build.AddHost { + args = append(args, "--add-host", host) + } if build.Target != "" { args = append(args, "--target", build.Target) }