code: func GetContextFromReader(rc io.ReadCloser, dockerfileName string) (out io.ReadCloser, relDockerfile string, err error) {
  	rc, isArchive, err := DetectArchiveReader(rc)
  	if err != nil {
  		return nil, "", err
  	}
  
  	if isArchive {
  		return rc, dockerfileName, nil
  	}
  
  	// Input should be read as a Dockerfile.
  
  	if dockerfileName == "-" {
  		return nil, "", errors.New("build context is not an archive")
  	}
  
  	dockerfileDir, err := WriteTempDockerfile(rc)
  	if err != nil {
  		return nil, "", err
  	}
  
  	tar, err := archive.Tar(dockerfileDir, archive.Uncompressed)
  	if err != nil {
  		return nil, "", err
  	}
  
  	return ioutils.NewReadCloserWrapper(tar, func() error {
  		err := tar.Close()
  		os.RemoveAll(dockerfileDir)
  		return err
  	}), DefaultDockerfileName, nil
  }
docs: // GetContextFromReader will read the contents of the given reader as either a
  // Dockerfile or tar archive. Returns a tar archive used as a context and a
  // path to the Dockerfile inside the tar.