|
@@ -27,21 +27,20 @@ import (
|
|
|
"github.com/docker/buildx/driver"
|
|
|
_ "github.com/docker/buildx/driver/docker" // required to get default driver registered
|
|
|
"github.com/docker/buildx/util/buildflags"
|
|
|
- "github.com/docker/buildx/util/progress"
|
|
|
+ xprogress "github.com/docker/buildx/util/progress"
|
|
|
moby "github.com/docker/docker/api/types"
|
|
|
bclient "github.com/moby/buildkit/client"
|
|
|
"github.com/moby/buildkit/session"
|
|
|
"github.com/moby/buildkit/session/auth/authprovider"
|
|
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
|
|
|
|
|
- composeprogress "github.com/docker/compose-cli/api/progress"
|
|
|
- "github.com/docker/compose-cli/cli/metrics"
|
|
|
"github.com/docker/compose-cli/pkg/api"
|
|
|
- "github.com/docker/compose-cli/utils"
|
|
|
+ "github.com/docker/compose-cli/pkg/progress"
|
|
|
+ "github.com/docker/compose-cli/pkg/utils"
|
|
|
)
|
|
|
|
|
|
func (s *composeService) Build(ctx context.Context, project *types.Project, options api.BuildOptions) error {
|
|
|
- return composeprogress.Run(ctx, func(ctx context.Context) error {
|
|
|
+ return progress.Run(ctx, func(ctx context.Context) error {
|
|
|
return s.build(ctx, project, options)
|
|
|
})
|
|
|
}
|
|
@@ -108,9 +107,9 @@ func (s *composeService) ensureImagesExists(ctx context.Context, project *types.
|
|
|
return err
|
|
|
}
|
|
|
|
|
|
- mode := progress.PrinterModeAuto
|
|
|
+ mode := xprogress.PrinterModeAuto
|
|
|
if quietPull {
|
|
|
- mode = progress.PrinterModeQuiet
|
|
|
+ mode = xprogress.PrinterModeQuiet
|
|
|
}
|
|
|
opts, imagesToBuild, err := s.getBuildOptions(project, images)
|
|
|
if err != nil {
|
|
@@ -193,7 +192,7 @@ func (s *composeService) doBuild(ctx context.Context, project *types.Project, op
|
|
|
// no support yet for Windows container builds in Buildkit
|
|
|
// https://docs.docker.com/develop/develop-images/build_enhancements/#limitations
|
|
|
err := s.windowsBuild(opts, mode)
|
|
|
- return nil, metrics.WrapCategorisedComposeError(err, metrics.BuildFailure)
|
|
|
+ return nil, WrapCategorisedComposeError(err, BuildFailure)
|
|
|
}
|
|
|
if len(opts) == 0 {
|
|
|
return nil, nil
|
|
@@ -216,7 +215,7 @@ func (s *composeService) doBuild(ctx context.Context, project *types.Project, op
|
|
|
// build and will lock
|
|
|
progressCtx, cancel := context.WithCancel(context.Background())
|
|
|
defer cancel()
|
|
|
- w := progress.NewPrinter(progressCtx, os.Stdout, mode)
|
|
|
+ w := xprogress.NewPrinter(progressCtx, os.Stdout, mode)
|
|
|
|
|
|
// We rely on buildx "docker" builder integrated in docker engine, so don't need a DockerAPI here
|
|
|
response, err := build.Build(ctx, driverInfo, opts, nil, nil, w)
|
|
@@ -225,10 +224,10 @@ func (s *composeService) doBuild(ctx context.Context, project *types.Project, op
|
|
|
err = errW
|
|
|
}
|
|
|
if err != nil {
|
|
|
- return nil, metrics.WrapCategorisedComposeError(err, metrics.BuildFailure)
|
|
|
+ return nil, WrapCategorisedComposeError(err, BuildFailure)
|
|
|
}
|
|
|
|
|
|
- cw := composeprogress.ContextWriter(ctx)
|
|
|
+ cw := progress.ContextWriter(ctx)
|
|
|
for _, c := range observedState {
|
|
|
for imageName := range opts {
|
|
|
if c.Image == imageName {
|