@@ -22,6 +22,7 @@ import (
2222 "fmt"
2323 "os"
2424 "strings"
25+ "sync"
2526
2627 "github.com/compose-spec/compose-go/v2/types"
2728 "github.com/containerd/platforms"
@@ -32,6 +33,7 @@ import (
3233 "github.com/docker/buildx/util/buildflags"
3334 xprogress "github.com/docker/buildx/util/progress"
3435 "github.com/docker/cli/cli/command"
36+ "github.com/docker/cli/cli/hints"
3537 cliopts "github.com/docker/cli/opts"
3638 "github.com/docker/compose/v2/internal/tracing"
3739 "github.com/docker/compose/v2/pkg/api"
@@ -63,6 +65,10 @@ func (s *composeService) Build(ctx context.Context, project *types.Project, opti
6365 }, s .stdinfo (), "Building" )
6466}
6567
68+ const bakeSuggest = "Compose now can delegate build to bake for better performances\n Just set COMPOSE_BAKE=true"
69+
70+ var suggest sync.Once
71+
6672//nolint:gocyclo
6773func (s * composeService ) build (ctx context.Context , project * types.Project , options api.BuildOptions , localImages map [string ]string ) (map [string ]string , error ) {
6874 imageIDs := map [string ]string {}
@@ -133,6 +139,11 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
133139 w * xprogress.Printer
134140 )
135141 if buildkitEnabled {
142+ if hints .Enabled () {
143+ suggest .Do (func () {
144+ fmt .Fprintln (s .dockerCli .Out (), bakeSuggest ) //nolint:errcheck
145+ })
146+ }
136147 builderName := options .Builder
137148 if builderName == "" {
138149 builderName = os .Getenv ("BUILDX_BUILDER" )
0 commit comments