Skip to content

Commit 44a64f3

Browse files
Merge pull request #6 from depot/default-load
Default `depot build` to `--load`
2 parents 306a3f9 + 2d104ff commit 44a64f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/cmd/build/build.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ func NewCmdBuild() *cobra.Command {
5050
os.Exit(1)
5151
}
5252

53+
// If neither --load or --push is specified, we default to --load
54+
if !options.exportLoad && !options.exportPush && len(options.outputs) == 0 {
55+
options.exportLoad = true
56+
}
57+
5358
options.contextPath = args[0]
5459
return runBuild(dockerCli, options)
5560
},
@@ -77,7 +82,7 @@ func NewCmdBuild() *cobra.Command {
7782
flags.StringVarP(&options.dockerfileName, "file", "f", "", `Name of the Dockerfile (default: "PATH/Dockerfile")`)
7883
flags.StringVar(&options.imageIDFile, "iidfile", "", "Write the image ID to the file")
7984
flags.StringArrayVar(&options.labels, "label", []string{}, "Set metadata for an image")
80-
flags.BoolVar(&options.exportLoad, "load", false, `Shorthand for "--output=type=docker"`)
85+
flags.BoolVar(&options.exportLoad, "load", false, `Shorthand for "--output=type=docker" (default unless --push or --output is specified)`)
8186
flags.StringVar(&options.networkMode, "network", "default", `Set the networking mode for the "RUN" instructions during build`)
8287
flags.StringArrayVar(&options.noCacheFilter, "no-cache-filter", []string{}, "Do not cache specified stages")
8388
flags.StringArrayVarP(&options.outputs, "output", "o", []string{}, `Output destination (format: "type=local,dest=path")`)

0 commit comments

Comments
 (0)