|
|
@@ -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")
|