code: func (builder *OnBuild) CreateDockerfile(config *api.Config) error {
  	buffer := bytes.Buffer{}
  	uploadDir := filepath.Join(config.WorkingDir, "upload", "src")
  	buffer.WriteString(fmt.Sprintf("FROM %s\n", config.BuilderImage))
  	entrypoint, err := GuessEntrypoint(builder.fs, uploadDir)
  	if err != nil {
  		return err
  	}
  	env, err := scripts.GetEnvironment(filepath.Join(config.WorkingDir, constants.Source))
  	if err != nil {
  		glog.V(1).Infof("Environment: %v", err)
  	} else {
  		buffer.WriteString(scripts.ConvertEnvironmentToDocker(env))
  	}
  	// If there is an assemble script present, run it as part of the build process
  	// as the last thing.
  	if builder.hasAssembleScript(config) {
  		buffer.WriteString("RUN sh assemble\n")
  	}
  	// FIXME: This assumes that the WORKDIR is set to the application source root
  	//        directory.
  	buffer.WriteString(fmt.Sprintf(`ENTRYPOINT ["./%s"]`+"\n", entrypoint))
  	return builder.fs.WriteFile(filepath.Join(uploadDir, "Dockerfile"), buffer.Bytes())
  }
docs: // CreateDockerfile creates the ONBUILD Dockerfile