mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-31 08:03:43 +08:00 
			
		
		
		
	build: add no-cache-filter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
		| @@ -67,6 +67,7 @@ type Options struct { | ||||
| 	Labels        map[string]string | ||||
| 	NetworkMode   string | ||||
| 	NoCache       bool | ||||
| 	NoCacheFilter []string | ||||
| 	Platforms     []specs.Platform | ||||
| 	Pull          bool | ||||
| 	Session       []session.Attachable | ||||
| @@ -527,6 +528,9 @@ func toSolveOpt(ctx context.Context, d driver.Driver, multiDriver bool, opt Opti | ||||
| 	if opt.Target != "" { | ||||
| 		so.FrontendAttrs["target"] = opt.Target | ||||
| 	} | ||||
| 	if len(opt.NoCacheFilter) > 0 { | ||||
| 		so.FrontendAttrs["no-cache"] = strings.Join(opt.NoCacheFilter, ",") | ||||
| 	} | ||||
| 	if opt.NoCache { | ||||
| 		so.FrontendAttrs["no-cache"] = "" | ||||
| 	} | ||||
|   | ||||
| @@ -52,6 +52,7 @@ type buildOptions struct { | ||||
| 	imageIDFile   string | ||||
| 	labels        []string | ||||
| 	networkMode   string | ||||
| 	noCacheFilter []string | ||||
| 	outputs       []string | ||||
| 	platforms     []string | ||||
| 	quiet         bool | ||||
| @@ -122,6 +123,7 @@ func runBuild(dockerCli command.Cli, in buildOptions) (err error) { | ||||
| 		Labels:        listToMap(in.labels, false), | ||||
| 		NetworkMode:   in.networkMode, | ||||
| 		NoCache:       noCache, | ||||
| 		NoCacheFilter: in.noCacheFilter, | ||||
| 		Pull:          pull, | ||||
| 		ShmSize:       in.shmSize, | ||||
| 		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.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.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 | | ||||
| | `--network string` | Set the networking mode for the `RUN` instructions during build | | ||||
| | `--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`) | | ||||
| | [`--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 | | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tonis Tiigi
					Tonis Tiigi