From f534ee0c2e682ad25ababef25eb94da447204d23 Mon Sep 17 00:00:00 2001 From: Sune Keller Date: Tue, 18 Jun 2019 23:51:12 +0200 Subject: [PATCH] Read COMPOSE_FILE and COMPOSE_PATH_SEPARATOR Signed-off-by: Sune Keller --- commands/bake.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/commands/bake.go b/commands/bake.go index 55aa7d7a..3f497983 100644 --- a/commands/bake.go +++ b/commands/bake.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "os" + "strings" "github.com/docker/buildx/bake" "github.com/docker/cli/cli/command" @@ -23,9 +24,20 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions) error { ctx := appcontext.Context() if len(in.files) == 0 { - files, err := defaultFiles() - if err != nil { - return err + var files []string + composeFileVar, ok := os.LookupEnv("COMPOSE_FILE") + if ok { + composePathSeparator, ok := os.LookupEnv("COMPOSE_PATH_SEPARATOR") + if !ok { + composePathSeparator = "," + } + files = strings.Split(composeFileVar, composePathSeparator) + } else { + defaultFiles, err := defaultFiles() + if err != nil { + return err + } + files = defaultFiles } if len(files) == 0 { return errors.Errorf("no docker-compose.yml or docker-bake.hcl found, specify build file with -f/--file")