@@ -6,13 +6,15 @@ import (
66 "fmt"
77 "os"
88
9+ "github.com/containerd/console"
910 "github.com/containerd/containerd/platforms"
1011 "github.com/docker/buildx/bake"
1112 "github.com/docker/buildx/build"
1213 "github.com/docker/buildx/builder"
1314 "github.com/docker/buildx/util/buildflags"
1415 "github.com/docker/buildx/util/cobrautil/completion"
1516 "github.com/docker/buildx/util/confutil"
17+ "github.com/docker/buildx/util/desktop"
1618 "github.com/docker/buildx/util/dockerutil"
1719 "github.com/docker/buildx/util/progress"
1820 "github.com/docker/buildx/util/tracing"
@@ -117,8 +119,19 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions, cFlags com
117119 progressTextDesc = fmt .Sprintf ("building with %q instance using %s driver" , b .Name , b .Driver )
118120 }
119121
120- printer , err := progress .NewPrinter (ctx2 , os .Stderr , os .Stderr , cFlags .progress ,
122+ var term bool
123+ if _ , err := console .ConsoleFromFile (os .Stderr ); err == nil {
124+ term = true
125+ }
126+
127+ var printer * progress.Printer
128+ printer , err = progress .NewPrinter (ctx2 , os .Stderr , os .Stderr , cFlags .progress ,
121129 progress .WithDesc (progressTextDesc , progressConsoleDesc ),
130+ progress .WithOnClose (func () {
131+ if cFlags .progress != progress .PrinterModeQuiet {
132+ desktop .PrintBuildDetails (os .Stderr , printer .BuildRefs (), term )
133+ }
134+ }),
122135 )
123136 if err != nil {
124137 return err
0 commit comments