diff --git a/pkg/compose/build.go b/pkg/compose/build.go index 3e842abf79..ba2e01f613 100644 --- a/pkg/compose/build.go +++ b/pkg/compose/build.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "strings" + "sync" "github.com/compose-spec/compose-go/v2/types" "github.com/containerd/platforms" @@ -32,6 +33,7 @@ import ( "github.com/docker/buildx/util/buildflags" xprogress "github.com/docker/buildx/util/progress" "github.com/docker/cli/cli/command" + "github.com/docker/cli/cli/hints" cliopts "github.com/docker/cli/opts" "github.com/docker/compose/v2/internal/tracing" "github.com/docker/compose/v2/pkg/api" @@ -63,6 +65,10 @@ func (s *composeService) Build(ctx context.Context, project *types.Project, opti }, s.stdinfo(), "Building") } +const bakeSuggest = "Compose now can delegate build to bake for better performances\nJust set COMPOSE_BAKE=true" + +var suggest sync.Once + //nolint:gocyclo func (s *composeService) build(ctx context.Context, project *types.Project, options api.BuildOptions, localImages map[string]string) (map[string]string, error) { imageIDs := map[string]string{} @@ -133,6 +139,11 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti w *xprogress.Printer ) if buildkitEnabled { + if hints.Enabled() { + suggest.Do(func() { + fmt.Fprintln(s.dockerCli.Out(), bakeSuggest) //nolint:errcheck + }) + } builderName := options.Builder if builderName == "" { builderName = os.Getenv("BUILDX_BUILDER")