Skip to content

Commit 540cba5

Browse files
committed
use Bake by default
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 27e90a3 commit 540cba5

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

pkg/compose/build.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"github.com/docker/buildx/util/buildflags"
3535
xprogress "github.com/docker/buildx/util/progress"
3636
"github.com/docker/cli/cli/command"
37-
"github.com/docker/cli/cli/hints"
3837
cliopts "github.com/docker/cli/opts"
3938
"github.com/docker/compose/v2/internal/tracing"
4039
"github.com/docker/compose/v2/pkg/api"
@@ -71,8 +70,6 @@ func (s *composeService) Build(ctx context.Context, project *types.Project, opti
7170
}, s.stdinfo(), "Building")
7271
}
7372

74-
const bakeSuggest = "Compose can now delegate builds to bake for better performance.\n To do so, set COMPOSE_BAKE=true."
75-
7673
var suggest sync.Once
7774

7875
//nolint:gocyclo
@@ -156,11 +153,6 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
156153
w *xprogress.Printer
157154
)
158155
if buildkitEnabled {
159-
if hints.Enabled() && progress.Mode != progress.ModeQuiet && progress.Mode != progress.ModeJSON {
160-
suggest.Do(func() {
161-
fmt.Fprintln(s.dockerCli.Out(), bakeSuggest) //nolint:errcheck
162-
})
163-
}
164156
builderName := options.Builder
165157
if builderName == "" {
166158
builderName = os.Getenv("BUILDX_BUILDER")

pkg/compose/build_bake.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@ import (
5151
func buildWithBake(dockerCli command.Cli) (bool, error) {
5252
b, ok := os.LookupEnv("COMPOSE_BAKE")
5353
if !ok {
54-
if dockerCli.ConfigFile().Plugins["compose"]["build"] == "bake" {
55-
b, ok = "true", true
56-
}
57-
}
58-
if !ok {
59-
return false, nil
54+
b = "true"
6055
}
6156
bake, err := strconv.ParseBool(b)
6257
if err != nil {
@@ -72,6 +67,7 @@ func buildWithBake(dockerCli command.Cli) (bool, error) {
7267
}
7368
if !enabled {
7469
logrus.Warnf("Docker Compose is configured to build using Bake, but buildkit isn't enabled")
70+
return false, nil
7571
}
7672

7773
_, err = manager.GetPlugin("buildx", dockerCli, &cobra.Command{})

pkg/e2e/build_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ func TestBuildImageDependencies(t *testing.T) {
284284

285285
t.Run("BuildKit by dependency order", func(t *testing.T) {
286286
cli := NewCLI(t, WithEnv(
287-
"DOCKER_BUILDKIT=1",
287+
"DOCKER_BUILDKIT=1", "COMPOSE_BAKE=0",
288288
"COMPOSE_FILE=./fixtures/build-dependencies/classic.yaml",
289289
))
290290
doTest(t, cli, "build")
@@ -293,7 +293,7 @@ func TestBuildImageDependencies(t *testing.T) {
293293

294294
t.Run("BuildKit by additional contexts", func(t *testing.T) {
295295
cli := NewCLI(t, WithEnv(
296-
"DOCKER_BUILDKIT=1",
296+
"DOCKER_BUILDKIT=1", "COMPOSE_BAKE=0",
297297
"COMPOSE_FILE=./fixtures/build-dependencies/compose.yaml",
298298
))
299299
doTest(t, cli, "build")

0 commit comments

Comments
 (0)