Skip to content

Commit

Permalink
Use io.copy for build context compression
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
dmcgowan committed Jan 3, 2025
1 parent 7138107 commit a8d1b43
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cli/command/image/build/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a8d1b43

Please sign in to comment.