mirror of https://github.com/docker/cli.git
Merge pull request #27049 from dnephin/fix-label-flag-type
Use ListOpt for build labels
This commit is contained in:
commit
ebfd0d6602
|
@ -37,7 +37,7 @@ type buildOptions struct {
|
||||||
context string
|
context string
|
||||||
dockerfileName string
|
dockerfileName string
|
||||||
tags opts.ListOpts
|
tags opts.ListOpts
|
||||||
labels []string
|
labels opts.ListOpts
|
||||||
buildArgs opts.ListOpts
|
buildArgs opts.ListOpts
|
||||||
ulimits *runconfigopts.UlimitOpt
|
ulimits *runconfigopts.UlimitOpt
|
||||||
memory string
|
memory string
|
||||||
|
@ -65,6 +65,7 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
tags: opts.NewListOpts(validateTag),
|
tags: opts.NewListOpts(validateTag),
|
||||||
buildArgs: opts.NewListOpts(runconfigopts.ValidateArg),
|
buildArgs: opts.NewListOpts(runconfigopts.ValidateArg),
|
||||||
ulimits: runconfigopts.NewUlimitOpt(&ulimits),
|
ulimits: runconfigopts.NewUlimitOpt(&ulimits),
|
||||||
|
labels: opts.NewListOpts(runconfigopts.ValidateEnv),
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -93,7 +94,7 @@ func NewBuildCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
flags.StringVar(&options.cpuSetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
|
flags.StringVar(&options.cpuSetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)")
|
||||||
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
|
flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
|
||||||
flags.StringVar(&options.isolation, "isolation", "", "Container isolation technology")
|
flags.StringVar(&options.isolation, "isolation", "", "Container isolation technology")
|
||||||
flags.StringSliceVar(&options.labels, "label", []string{}, "Set metadata for an image")
|
flags.Var(&options.labels, "label", "Set metadata for an image")
|
||||||
flags.BoolVar(&options.noCache, "no-cache", false, "Do not use cache when building the image")
|
flags.BoolVar(&options.noCache, "no-cache", false, "Do not use cache when building the image")
|
||||||
flags.BoolVar(&options.rm, "rm", true, "Remove intermediate containers after a successful build")
|
flags.BoolVar(&options.rm, "rm", true, "Remove intermediate containers after a successful build")
|
||||||
flags.BoolVar(&options.forceRm, "force-rm", false, "Always remove intermediate containers")
|
flags.BoolVar(&options.forceRm, "force-rm", false, "Always remove intermediate containers")
|
||||||
|
@ -290,7 +291,7 @@ func runBuild(dockerCli *command.DockerCli, options buildOptions) error {
|
||||||
Ulimits: options.ulimits.GetList(),
|
Ulimits: options.ulimits.GetList(),
|
||||||
BuildArgs: runconfigopts.ConvertKVStringsToMap(options.buildArgs.GetAll()),
|
BuildArgs: runconfigopts.ConvertKVStringsToMap(options.buildArgs.GetAll()),
|
||||||
AuthConfigs: authConfig,
|
AuthConfigs: authConfig,
|
||||||
Labels: runconfigopts.ConvertKVStringsToMap(options.labels),
|
Labels: runconfigopts.ConvertKVStringsToMap(options.labels.GetAll()),
|
||||||
CacheFrom: options.cacheFrom,
|
CacheFrom: options.cacheFrom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue