code: func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string, error) {
  	options := config.Options
  	useBuildKit := options.Version == types.BuilderBuildKit
  
  	tagger, err := NewTagger(b.imageComponent, config.ProgressWriter.StdoutFormatter, options.Tags)
  	if err != nil {
  		return "", err
  	}
  
  	var build *builder.Result
  	if useBuildKit {
  		build, err = b.buildkit.Build(ctx, config)
  		if err != nil {
  			return "", err
  		}
  	} else {
  		build, err = b.builder.Build(ctx, config)
  		if err != nil {
  			return "", err
  		}
  	}
  
  	if build == nil {
  		return "", nil
  	}
  
  	var imageID = build.ImageID
  	if options.Squash {
  		if imageID, err = squashBuild(build, b.imageComponent); err != nil {
  			return "", err
  		}
  		if config.ProgressWriter.AuxFormatter != nil {
  			if err = config.ProgressWriter.AuxFormatter.Emit("moby.image.id", types.BuildResult{ID: imageID}); err != nil {
  				return "", err
  			}
  		}
  	}
  
  	if !useBuildKit {
  		stdout := config.ProgressWriter.StdoutFormatter
  		fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID))
  	}
  	err = tagger.TagImages(image.ID(imageID))
  	return imageID, err
  }
docs: // Build builds an image from a Source