Skip to content

Commit 33172d5

Browse files
committed
let user know bake is now supported
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 3f1a6b7 commit 33172d5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/compose/build.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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\nJust set COMPOSE_BAKE=true"
69+
70+
var suggest sync.Once
71+
6672
//nolint:gocyclo
6773
func (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

Comments
 (0)