Use io.copy for build context compression

The use of pools here is unnecessary and creates a code dependency on
moby library which will move to internal.

The pool does not provide any value here since it is only done for a
single operation and unlikely performed in alongside other operations
which are re-using the buffers many times between garbage collections.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Derek McGowan
2025-01-02 17:19:41 -08:00
committed by Sebastiaan van Stijn
parent 7138107e87
commit 7b37f30da2
3 changed files with 1 additions and 140 deletions

View File

@ -17,7 +17,6 @@ import (
"github.com/docker/docker/builder/remotecontext/git"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/progress"
"github.com/docker/docker/pkg/streamformatter"
"github.com/docker/docker/pkg/stringid"
@ -434,7 +433,7 @@ func Compress(buildCtx io.ReadCloser) (io.ReadCloser, error) {
}
defer buildCtx.Close()
if _, err := pools.Copy(compressWriter, buildCtx); err != nil {
if _, err := io.Copy(compressWriter, buildCtx); err != nil {
pipeWriter.CloseWithError(errors.Wrap(err, "failed to compress context"))
compressWriter.Close()
return