Merge pull request #708 from AkihiroSuda/cli-no-cache

buildctl: support --no-cache for Dockerfile frontend
docker-18.09 dockerfile/0.9.0
Tõnis Tiigi 2018-10-30 10:51:12 -07:00 committed by GitHub
commit 91cd9b4043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -61,7 +61,7 @@ var buildCommand = cli.Command{
},
cli.BoolFlag{
Name: "no-cache",
Usage: "Disable cache for all the vertices. Frontend is not supported.",
Usage: "Disable cache for all the vertices",
},
cli.StringFlag{
Name: "export-cache",
@ -218,9 +218,7 @@ func build(clicontext *cli.Context) error {
return err
}
} else {
if clicontext.Bool("no-cache") {
return errors.New("no-cache is not supported for frontends")
}
solveOpt.FrontendAttrs["no-cache"] = ""
}
eg.Go(func() error {

View File

@ -63,6 +63,10 @@ By default, the built image is loaded to Docker.
Name: "target",
Usage: "Set the target build stage to build.",
},
cli.BoolFlag{
Name: "no-cache",
Usage: "Do not use cache when building the image",
},
}, dockerIncompatibleFlags...)
app.Action = action
if err := app.Run(os.Args); err != nil {
@ -145,7 +149,9 @@ func newSolveOpt(clicontext *cli.Context, w io.WriteCloser) (*client.SolveOpt, e
if target := clicontext.String("target"); target != "" {
frontendAttrs["target"] = target
}
if clicontext.Bool("no-cache") {
frontendAttrs["no-cache"] = ""
}
for _, buildArg := range clicontext.StringSlice("build-arg") {
kv := strings.SplitN(buildArg, "=", 2)
if len(kv) != 2 {