0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-22 20:20:39 +00:00

Merge pull request #256 from recamshak/build-add-host

Add build add-host
This commit is contained in:
Thomas Boerger 2019-12-11 21:41:59 +01:00 committed by GitHub
commit 1f0cfcc3ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -223,6 +223,11 @@ func main() {
Usage: "do not use cached intermediate containers", Usage: "do not use cached intermediate containers",
EnvVar: "PLUGIN_NO_CACHE", 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 { if err := app.Run(os.Args); err != nil {
@ -257,6 +262,7 @@ func run(c *cli.Context) error {
Labels: c.StringSlice("custom-labels"), Labels: c.StringSlice("custom-labels"),
LabelSchema: c.StringSlice("label-schema"), LabelSchema: c.StringSlice("label-schema"),
NoCache: c.Bool("no-cache"), NoCache: c.Bool("no-cache"),
AddHost: c.StringSlice("add-host"),
}, },
Daemon: docker.Daemon{ Daemon: docker.Daemon{
Registry: c.String("docker.registry"), Registry: c.String("docker.registry"),

View File

@ -52,6 +52,7 @@ type (
LabelSchema []string // label-schema Label map LabelSchema []string // label-schema Label map
Labels []string // Label map Labels []string // Label map
NoCache bool // Docker build no-cache NoCache bool // Docker build no-cache
AddHost []string // Docker build add-host
} }
// Plugin defines the Docker plugin parameters. // Plugin defines the Docker plugin parameters.
@ -215,6 +216,9 @@ func commandBuild(build Build) *exec.Cmd {
for _, arg := range build.Args { for _, arg := range build.Args {
args = append(args, "--build-arg", arg) args = append(args, "--build-arg", arg)
} }
for _, host := range build.AddHost {
args = append(args, "--add-host", host)
}
if build.Target != "" { if build.Target != "" {
args = append(args, "--target", build.Target) args = append(args, "--target", build.Target)
} }