code: func WriteTempDockerfile(rc io.ReadCloser) (dockerfileDir string, err error) {
  	// err is a named return value, due to the defer call below.
  	dockerfileDir, err = ioutil.TempDir("", "docker-build-tempdockerfile-")
  	if err != nil {
  		return "", errors.Errorf("unable to create temporary context directory: %v", err)
  	}
  	defer func() {
  		if err != nil {
  			os.RemoveAll(dockerfileDir)
  		}
  	}()
  
  	f, err := os.Create(filepath.Join(dockerfileDir, DefaultDockerfileName))
  	if err != nil {
  		return "", err
  	}
  	defer f.Close()
  	if _, err := io.Copy(f, rc); err != nil {
  		return "", err
  	}
  	return dockerfileDir, rc.Close()
  }
docs: // WriteTempDockerfile writes a Dockerfile stream to a temporary file with a
  // name specified by DefaultDockerfileName and returns the path to the
  // temporary directory containing the Dockerfile.