|
|
|
@ -63,11 +63,13 @@ type buildOptions struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type commonOptions struct {
|
|
|
|
|
builderOptions
|
|
|
|
|
noCache *bool
|
|
|
|
|
progress string
|
|
|
|
|
pull *bool
|
|
|
|
|
exportPush bool
|
|
|
|
|
exportLoad bool
|
|
|
|
|
builder string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func runBuild(dockerCli command.Cli, in buildOptions) error {
|
|
|
|
@ -191,11 +193,11 @@ func runBuild(dockerCli command.Cli, in buildOptions) error {
|
|
|
|
|
contextPathHash = in.contextPath
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return buildTargets(ctx, dockerCli, map[string]build.Options{"default": opts}, in.progress, contextPathHash)
|
|
|
|
|
return buildTargets(ctx, dockerCli, map[string]build.Options{"default": opts}, in.progress, contextPathHash, in.builder)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func buildTargets(ctx context.Context, dockerCli command.Cli, opts map[string]build.Options, progressMode, contextPathHash string) error {
|
|
|
|
|
dis, err := getDefaultDrivers(ctx, dockerCli, contextPathHash)
|
|
|
|
|
func buildTargets(ctx context.Context, dockerCli command.Cli, opts map[string]build.Options, progressMode, contextPathHash, instance string) error {
|
|
|
|
|
dis, err := getInstanceOrDefault(ctx, dockerCli, instance, contextPathHash)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
@ -297,12 +299,13 @@ func buildCmd(dockerCli command.Cli) *cobra.Command {
|
|
|
|
|
|
|
|
|
|
flags.StringArrayVarP(&options.outputs, "output", "o", []string{}, "Output destination (format: type=local,dest=path)")
|
|
|
|
|
|
|
|
|
|
commonFlags(&options.commonOptions, flags)
|
|
|
|
|
commonBuildFlags(&options.commonOptions, flags)
|
|
|
|
|
|
|
|
|
|
return cmd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func commonFlags(options *commonOptions, flags *pflag.FlagSet) {
|
|
|
|
|
func commonBuildFlags(options *commonOptions, flags *pflag.FlagSet) {
|
|
|
|
|
builderFlags(&options.builderOptions, flags)
|
|
|
|
|
flags.Var(flagutil.Tristate(options.noCache), "no-cache", "Do not use cache when building the image")
|
|
|
|
|
flags.StringVar(&options.progress, "progress", "auto", "Set type of progress output (auto, plain, tty). Use plain to show container output")
|
|
|
|
|
flags.Var(flagutil.Tristate(options.pull), "pull", "Always attempt to pull a newer version of the image")
|
|
|
|
|