mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 01:53:42 +08:00 
			
		
		
		
	docs: make buildx build the canonical doc
Move descriptions of flags common with the legacy build client to the buildx build reference doc. Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
		@@ -38,7 +38,6 @@ import (
 | 
			
		||||
	"github.com/docker/buildx/util/osutil"
 | 
			
		||||
	"github.com/docker/buildx/util/progress"
 | 
			
		||||
	"github.com/docker/buildx/util/tracing"
 | 
			
		||||
	"github.com/docker/cli-docs-tool/annotation"
 | 
			
		||||
	"github.com/docker/cli/cli"
 | 
			
		||||
	"github.com/docker/cli/cli/command"
 | 
			
		||||
	dockeropts "github.com/docker/cli/opts"
 | 
			
		||||
@@ -529,10 +528,12 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions, debugConfig *debug.D
 | 
			
		||||
	options := &buildOptions{}
 | 
			
		||||
 | 
			
		||||
	cmd := &cobra.Command{
 | 
			
		||||
		Use:     "build [OPTIONS] PATH | URL | -",
 | 
			
		||||
		Aliases: []string{"b"},
 | 
			
		||||
		Short:   "Start a build",
 | 
			
		||||
		Args:    cli.ExactArgs(1),
 | 
			
		||||
		Use:   "build [OPTIONS] PATH | URL | -",
 | 
			
		||||
		Short: "Start a build",
 | 
			
		||||
		Args:  cli.ExactArgs(1),
 | 
			
		||||
		Annotations: map[string]string{
 | 
			
		||||
			"aliases": "docker build, docker builder build, docker image build, docker buildx b",
 | 
			
		||||
		},
 | 
			
		||||
		RunE: func(cmd *cobra.Command, args []string) error {
 | 
			
		||||
			options.contextPath = args[0]
 | 
			
		||||
			options.builder = rootOpts.builder
 | 
			
		||||
@@ -571,7 +572,6 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions, debugConfig *debug.D
 | 
			
		||||
	flags := cmd.Flags()
 | 
			
		||||
 | 
			
		||||
	flags.StringSliceVar(&options.extraHosts, "add-host", []string{}, `Add a custom host-to-IP mapping (format: "host:ip")`)
 | 
			
		||||
	flags.SetAnnotation("add-host", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/image/build/#add-host"})
 | 
			
		||||
 | 
			
		||||
	flags.StringSliceVar(&options.allow, "allow", []string{}, `Allow extra privileged entitlement (e.g., "network.host", "security.insecure")`)
 | 
			
		||||
 | 
			
		||||
@@ -584,12 +584,10 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions, debugConfig *debug.D
 | 
			
		||||
	flags.StringArrayVar(&options.cacheTo, "cache-to", []string{}, `Cache export destinations (e.g., "user/app:cache", "type=local,dest=path/to/dir")`)
 | 
			
		||||
 | 
			
		||||
	flags.StringVar(&options.cgroupParent, "cgroup-parent", "", `Set the parent cgroup for the "RUN" instructions during build`)
 | 
			
		||||
	flags.SetAnnotation("cgroup-parent", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/image/build/#cgroup-parent"})
 | 
			
		||||
 | 
			
		||||
	flags.StringArrayVar(&options.contexts, "build-context", []string{}, "Additional build contexts (e.g., name=path)")
 | 
			
		||||
 | 
			
		||||
	flags.StringVarP(&options.dockerfileName, "file", "f", "", `Name of the Dockerfile (default: "PATH/Dockerfile")`)
 | 
			
		||||
	flags.SetAnnotation("file", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/image/build/#file"})
 | 
			
		||||
 | 
			
		||||
	flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to a file")
 | 
			
		||||
 | 
			
		||||
@@ -616,10 +614,8 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions, debugConfig *debug.D
 | 
			
		||||
	flags.StringArrayVar(&options.ssh, "ssh", []string{}, `SSH agent socket or keys to expose to the build (format: "default|<id>[=<socket>|<key>[,<key>]]")`)
 | 
			
		||||
 | 
			
		||||
	flags.StringArrayVarP(&options.tags, "tag", "t", []string{}, `Name and optionally a tag (format: "name:tag")`)
 | 
			
		||||
	flags.SetAnnotation("tag", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/image/build/#tag"})
 | 
			
		||||
 | 
			
		||||
	flags.StringVar(&options.target, "target", "", "Set the target build stage to build")
 | 
			
		||||
	flags.SetAnnotation("target", annotation.ExternalURL, []string{"https://docs.docker.com/reference/cli/docker/image/build/#target"})
 | 
			
		||||
 | 
			
		||||
	options.ulimits = dockeropts.NewUlimitOpt(nil)
 | 
			
		||||
	flags.Var(options.ulimits, "ulimit", "Ulimit options")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user