bake: allow overriding no-cache and pull per target via --set

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass
2019-10-16 22:10:17 +00:00
parent 0e1f0e3c73
commit 2a257a8252
5 changed files with 89 additions and 13 deletions

View File

@ -46,6 +46,12 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions) error {
} else if in.exportLoad {
overrides = append(overrides, "*.output=type=docker")
}
if in.noCache != nil {
overrides = append(overrides, fmt.Sprintf("*.no-cache=%t", *in.noCache))
}
if in.pull != nil {
overrides = append(overrides, fmt.Sprintf("*.pull=%t", *in.pull))
}
m, err := bake.ReadTargets(ctx, in.files, targets, overrides)
if err != nil {
@ -61,7 +67,7 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions) error {
return nil
}
bo, err := bake.TargetsToBuildOpt(m, in.noCache, in.pull)
bo, err := bake.TargetsToBuildOpt(m)
if err != nil {
return err
}