code: func initializeStage(d dispatchRequest, cmd *instructions.Stage) error {
  	d.builder.imageProber.Reset()
  
  	var platform *specs.Platform
  	if v := cmd.Platform; v != "" {
  		v, err := d.getExpandedString(d.shlex, v)
  		if err != nil {
  			return errors.Wrapf(err, "failed to process arguments for platform %s", v)
  		}
  
  		p, err := platforms.Parse(v)
  		if err != nil {
  			return errors.Wrapf(err, "failed to parse platform %s", v)
  		}
  		if err := system.ValidatePlatform(p); err != nil {
  			return err
  		}
  		platform = &p
  	}
  
  	image, err := d.getFromImage(d.shlex, cmd.BaseName, platform)
  	if err != nil {
  		return err
  	}
  	state := d.state
  	if err := state.beginStage(cmd.Name, image); err != nil {
  		return err
  	}
  	if len(state.runConfig.OnBuild) > 0 {
  		triggers := state.runConfig.OnBuild
  		state.runConfig.OnBuild = nil
  		return dispatchTriggeredOnBuild(d, triggers)
  	}
  	return nil
  }
docs: // FROM [--platform=platform] imagename[:tag | @digest] [AS build-stage-name]
  //