configure buildx for plain output if --ansi=never has been set

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2022-11-24 15:42:28 +01:00 committed by Nicolas De loof
parent 770281e9d5
commit c3e5e49957
1 changed files with 4 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import (
"github.com/compose-spec/compose-go/loader"
"github.com/compose-spec/compose-go/types"
buildx "github.com/docker/buildx/util/progress"
"github.com/docker/compose/v2/pkg/progress"
"github.com/docker/compose/v2/pkg/utils"
"github.com/spf13/cobra"
@ -100,6 +101,9 @@ func buildCommand(p *projectOptions, backend api.Service) *cobra.Command {
if cmd.Flags().Changed("ssh") && opts.ssh == "" {
opts.ssh = "default"
}
if progress.Mode == progress.ModePlain && !cmd.Flags().Changed("progress") {
opts.progress = buildx.PrinterModePlain
}
return runBuild(ctx, backend, opts, args)
}),
ValidArgsFunction: completeServiceNames(p),