From 2056bdb41d15d3aa6ee4e783ec56f03acff09cef Mon Sep 17 00:00:00 2001 From: Andrew Gouin Date: Fri, 23 Jun 2023 17:49:02 -0600 Subject: [PATCH] common attrs for tar export (#141) --- docker/buildkit.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/docker/buildkit.go b/docker/buildkit.go index 014c53c..eb08262 100644 --- a/docker/buildkit.go +++ b/docker/buildkit.go @@ -69,6 +69,10 @@ func BuildDockerImageWithBuildKit( eg, ctx := errgroup.WithContext(ctx) + attrs := map[string]string{ + "name": strings.Join(tags, ","), + } + exports := make([]client.ExportEntry, 1) if tarExport != "" { @@ -77,7 +81,8 @@ func BuildDockerImageWithBuildKit( } exports[0] = client.ExportEntry{ - Type: "docker", + Type: "docker", + Attrs: attrs, Output: func(m map[string]string) (io.WriteCloser, error) { f, err := os.Create(tarExport) if err != nil { @@ -89,10 +94,8 @@ func BuildDockerImageWithBuildKit( } } else { export := client.ExportEntry{ - Type: "image", - Attrs: map[string]string{ - "name": strings.Join(tags, ","), - }, + Type: "image", + Attrs: attrs, } if push { export.Attrs["push"] = "true"