code: func AddDockerfileToBuildContext(dockerfileCtx io.ReadCloser, buildCtx io.ReadCloser) (io.ReadCloser, string, error) {
  	file, err := ioutil.ReadAll(dockerfileCtx)
  	dockerfileCtx.Close()
  	if err != nil {
  		return nil, "", err
  	}
  	now := time.Now()
  	hdrTmpl := &tar.Header{
  		Mode:       0600,
  		Uid:        0,
  		Gid:        0,
  		ModTime:    now,
  		Typeflag:   tar.TypeReg,
  		AccessTime: now,
  		ChangeTime: now,
  	}
  	randomName := ".dockerfile." + stringid.GenerateRandomID()[:20]
  
  	buildCtx = archive.ReplaceFileTarWrapper(buildCtx, map[string]archive.TarModifierFunc{
  		// Add the dockerfile with a random filename
  		randomName: func(_ string, h *tar.Header, content io.Reader) (*tar.Header, []byte, error) {
  			return hdrTmpl, file, nil
  		},
  		// Update .dockerignore to include the random filename
  		".dockerignore": func(_ string, h *tar.Header, content io.Reader) (*tar.Header, []byte, error) {
  			if h == nil {
  				h = hdrTmpl
  			}
  
  			b := &bytes.Buffer{}
  			if content != nil {
  				if _, err := b.ReadFrom(content); err != nil {
  					return nil, nil, err
  				}
  			} else {
  				b.WriteString(".dockerignore")
  			}
  			b.WriteString("\n" + randomName + "\n")
  			return h, b.Bytes(), nil
  		},
  	})
  	return buildCtx, randomName, nil
  }
docs: // AddDockerfileToBuildContext from a ReadCloser, returns a new archive and
  // the relative path to the dockerfile in the context.