From 87153b9d25f9cce1be573bc7e0a6def6a2e1f7bc Mon Sep 17 00:00:00 2001 From: Chris Crone Date: Fri, 11 Dec 2020 11:08:44 +0100 Subject: [PATCH] local.compose.build: Ensure images are exported If a user has BUILDX_NO_DEFAULT_LOAD=1 set, then the images will not be stored in the image store unless we explicitly say that they must be. Signed-off-by: Chris Crone --- go.mod | 1 + local/compose/build.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/go.mod b/go.mod index 3ce6ee7b2..85bf242f6 100644 --- a/go.mod +++ b/go.mod @@ -38,6 +38,7 @@ require ( github.com/joho/godotenv v1.3.0 github.com/labstack/echo v3.3.10+incompatible github.com/labstack/gommon v0.3.0 // indirect + github.com/moby/buildkit v0.8.1-0.20201205083753-0af7b1b9c693 github.com/moby/term v0.0.0-20201110203204-bea5bbe245bf github.com/morikuni/aec v1.0.0 github.com/opencontainers/go-digest v1.0.0 diff --git a/local/compose/build.go b/local/compose/build.go index 2c9cd7c48..648efbe55 100644 --- a/local/compose/build.go +++ b/local/compose/build.go @@ -29,6 +29,7 @@ import ( _ "github.com/docker/buildx/driver/docker" // required to get default driver registered "github.com/docker/buildx/util/progress" "github.com/docker/docker/errdefs" + bclient "github.com/moby/buildkit/client" ) func (s *composeService) Build(ctx context.Context, project *types.Project) error { @@ -154,6 +155,7 @@ func (s *composeService) toBuildOptions(service types.ServiceConfig, contextPath BuildArgs: flatten(mergeArgs(service.Build.Args, buildArgs)), Tags: tags, Target: service.Build.Target, + Exports: []bclient.ExportEntry{{Type: "image", Attrs: map[string]string{}}}, } }