mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-10-31 08:03:43 +08:00 
			
		
		
		
	Merge pull request #860 from tonistiigi/no-cache-filter
build: add no-cache-filter
This commit is contained in:
		| @@ -43,25 +43,26 @@ type buildOptions struct { | ||||
| 	contextPath    string | ||||
| 	dockerfileName string | ||||
|  | ||||
| 	allow        []string | ||||
| 	buildArgs    []string | ||||
| 	cacheFrom    []string | ||||
| 	cacheTo      []string | ||||
| 	cgroupParent string | ||||
| 	contexts     []string | ||||
| 	extraHosts   []string | ||||
| 	imageIDFile  string | ||||
| 	labels       []string | ||||
| 	networkMode  string | ||||
| 	outputs      []string | ||||
| 	platforms    []string | ||||
| 	quiet        bool | ||||
| 	secrets      []string | ||||
| 	shmSize      dockeropts.MemBytes | ||||
| 	ssh          []string | ||||
| 	tags         []string | ||||
| 	target       string | ||||
| 	ulimits      *dockeropts.UlimitOpt | ||||
| 	allow         []string | ||||
| 	buildArgs     []string | ||||
| 	cacheFrom     []string | ||||
| 	cacheTo       []string | ||||
| 	cgroupParent  string | ||||
| 	contexts      []string | ||||
| 	extraHosts    []string | ||||
| 	imageIDFile   string | ||||
| 	labels        []string | ||||
| 	networkMode   string | ||||
| 	noCacheFilter []string | ||||
| 	outputs       []string | ||||
| 	platforms     []string | ||||
| 	quiet         bool | ||||
| 	secrets       []string | ||||
| 	shmSize       dockeropts.MemBytes | ||||
| 	ssh           []string | ||||
| 	tags          []string | ||||
| 	target        string | ||||
| 	ulimits       *dockeropts.UlimitOpt | ||||
| 	commonOptions | ||||
| } | ||||
|  | ||||
| @@ -99,6 +100,10 @@ func runBuild(dockerCli command.Cli, in buildOptions) (err error) { | ||||
| 		pull = *in.pull | ||||
| 	} | ||||
|  | ||||
| 	if noCache && len(in.noCacheFilter) > 0 { | ||||
| 		return errors.Errorf("--no-cache and --no-cache-filter cannot currently be used together") | ||||
| 	} | ||||
|  | ||||
| 	if in.quiet && in.progress != "auto" && in.progress != "quiet" { | ||||
| 		return errors.Errorf("progress=%s and quiet cannot be used together", in.progress) | ||||
| 	} else if in.quiet { | ||||
| @@ -117,17 +122,18 @@ func runBuild(dockerCli command.Cli, in buildOptions) (err error) { | ||||
| 			InStream:       os.Stdin, | ||||
| 			NamedContexts:  contexts, | ||||
| 		}, | ||||
| 		BuildArgs:   listToMap(in.buildArgs, true), | ||||
| 		ExtraHosts:  in.extraHosts, | ||||
| 		ImageIDFile: in.imageIDFile, | ||||
| 		Labels:      listToMap(in.labels, false), | ||||
| 		NetworkMode: in.networkMode, | ||||
| 		NoCache:     noCache, | ||||
| 		Pull:        pull, | ||||
| 		ShmSize:     in.shmSize, | ||||
| 		Tags:        in.tags, | ||||
| 		Target:      in.target, | ||||
| 		Ulimits:     in.ulimits, | ||||
| 		BuildArgs:     listToMap(in.buildArgs, true), | ||||
| 		ExtraHosts:    in.extraHosts, | ||||
| 		ImageIDFile:   in.imageIDFile, | ||||
| 		Labels:        listToMap(in.labels, false), | ||||
| 		NetworkMode:   in.networkMode, | ||||
| 		NoCache:       noCache, | ||||
| 		NoCacheFilter: in.noCacheFilter, | ||||
| 		Pull:          pull, | ||||
| 		ShmSize:       in.shmSize, | ||||
| 		Tags:          in.tags, | ||||
| 		Target:        in.target, | ||||
| 		Ulimits:       in.ulimits, | ||||
| 	} | ||||
|  | ||||
| 	platforms, err := platformutil.Parse(in.platforms) | ||||
| @@ -360,6 +366,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") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tõnis Tiigi
					Tõnis Tiigi