code: func newBuilder(clientCtx context.Context, options builderOptions) (*Builder, error) {
  	config := options.Options
  	if config == nil {
  		config = new(types.ImageBuildOptions)
  	}
  
  	b := &Builder{
  		clientCtx:        clientCtx,
  		options:          config,
  		Stdout:           options.ProgressWriter.StdoutFormatter,
  		Stderr:           options.ProgressWriter.StderrFormatter,
  		Aux:              options.ProgressWriter.AuxFormatter,
  		Output:           options.ProgressWriter.Output,
  		docker:           options.Backend,
  		idMapping:        options.IDMapping,
  		imageSources:     newImageSources(clientCtx, options),
  		pathCache:        options.PathCache,
  		imageProber:      newImageProber(options.Backend, config.CacheFrom, config.NoCache),
  		containerManager: newContainerManager(options.Backend),
  	}
  
  	// same as in Builder.Build in builder/builder-next/builder.go
  	// TODO: remove once config.Platform is of type specs.Platform
  	if config.Platform != "" {
  		sp, err := platforms.Parse(config.Platform)
  		if err != nil {
  			return nil, err
  		}
  		if err := system.ValidatePlatform(sp); err != nil {
  			return nil, err
  		}
  		b.platform = &sp
  	}
  
  	return b, nil
  }
docs: // newBuilder creates a new Dockerfile builder from an optional dockerfile and a Options.