mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-30 09:25:45 +08:00
build: add no-cache-filter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
parent
e60f0f2c4f
commit
3b47722032
@ -67,6 +67,7 @@ type Options struct {
|
|||||||
Labels map[string]string
|
Labels map[string]string
|
||||||
NetworkMode string
|
NetworkMode string
|
||||||
NoCache bool
|
NoCache bool
|
||||||
|
NoCacheFilter []string
|
||||||
Platforms []specs.Platform
|
Platforms []specs.Platform
|
||||||
Pull bool
|
Pull bool
|
||||||
Session []session.Attachable
|
Session []session.Attachable
|
||||||
@ -527,6 +528,9 @@ func toSolveOpt(ctx context.Context, d driver.Driver, multiDriver bool, opt Opti
|
|||||||
if opt.Target != "" {
|
if opt.Target != "" {
|
||||||
so.FrontendAttrs["target"] = opt.Target
|
so.FrontendAttrs["target"] = opt.Target
|
||||||
}
|
}
|
||||||
|
if len(opt.NoCacheFilter) > 0 {
|
||||||
|
so.FrontendAttrs["no-cache"] = strings.Join(opt.NoCacheFilter, ",")
|
||||||
|
}
|
||||||
if opt.NoCache {
|
if opt.NoCache {
|
||||||
so.FrontendAttrs["no-cache"] = ""
|
so.FrontendAttrs["no-cache"] = ""
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ type buildOptions struct {
|
|||||||
imageIDFile string
|
imageIDFile string
|
||||||
labels []string
|
labels []string
|
||||||
networkMode string
|
networkMode string
|
||||||
|
noCacheFilter []string
|
||||||
outputs []string
|
outputs []string
|
||||||
platforms []string
|
platforms []string
|
||||||
quiet bool
|
quiet bool
|
||||||
@ -122,6 +123,7 @@ func runBuild(dockerCli command.Cli, in buildOptions) (err error) {
|
|||||||
Labels: listToMap(in.labels, false),
|
Labels: listToMap(in.labels, false),
|
||||||
NetworkMode: in.networkMode,
|
NetworkMode: in.networkMode,
|
||||||
NoCache: noCache,
|
NoCache: noCache,
|
||||||
|
NoCacheFilter: in.noCacheFilter,
|
||||||
Pull: pull,
|
Pull: pull,
|
||||||
ShmSize: in.shmSize,
|
ShmSize: in.shmSize,
|
||||||
Tags: in.tags,
|
Tags: in.tags,
|
||||||
@ -363,6 +365,8 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
|
|||||||
|
|
||||||
flags.StringVar(&options.networkMode, "network", "default", `Set the networking mode for the "RUN" instructions during build`)
|
flags.StringVar(&options.networkMode, "network", "default", `Set the networking mode for the "RUN" instructions during build`)
|
||||||
|
|
||||||
|
flags.StringArrayVar(&options.noCacheFilter, "no-cache-filter", []string{}, "Do not cache specified stages")
|
||||||
|
|
||||||
flags.StringArrayVarP(&options.outputs, "output", "o", []string{}, `Output destination (format: "type=local,dest=path")`)
|
flags.StringArrayVarP(&options.outputs, "output", "o", []string{}, `Output destination (format: "type=local,dest=path")`)
|
||||||
|
|
||||||
flags.StringArrayVar(&options.platforms, "platform", platformsDefault, "Set target platform for build")
|
flags.StringArrayVar(&options.platforms, "platform", platformsDefault, "Set target platform for build")
|
||||||
|
@ -30,6 +30,7 @@ Start a build
|
|||||||
| `--metadata-file string` | Write build result metadata to the file |
|
| `--metadata-file string` | Write build result metadata to the file |
|
||||||
| `--network string` | Set the networking mode for the `RUN` instructions during build |
|
| `--network string` | Set the networking mode for the `RUN` instructions during build |
|
||||||
| `--no-cache` | Do not use cache when building the image |
|
| `--no-cache` | Do not use cache when building the image |
|
||||||
|
| `--no-cache-filter stringArray` | Do not cache specified stages |
|
||||||
| [`-o`](#output), [`--output stringArray`](#output) | Output destination (format: `type=local,dest=path`) |
|
| [`-o`](#output), [`--output stringArray`](#output) | Output destination (format: `type=local,dest=path`) |
|
||||||
| [`--platform stringArray`](#platform) | Set target platform for build |
|
| [`--platform stringArray`](#platform) | Set target platform for build |
|
||||||
| [`--progress string`](#progress) | Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output |
|
| [`--progress string`](#progress) | Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user