Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildctl: support --no-cache for Dockerfile frontend #708

Merged
merged 1 commit into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cmd/buildctl/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion examples/build-using-dockerfile/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down