Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| ... | ... |
@@ -82,8 +82,8 @@ func (b *Backend) Build(ctx context.Context, config backend.BuildConfig) (string |
| 82 | 82 |
if !useBuildKit {
|
| 83 | 83 |
stdout := config.ProgressWriter.StdoutFormatter |
| 84 | 84 |
fmt.Fprintf(stdout, "Successfully built %s\n", stringid.TruncateID(imageID)) |
| 85 |
+ err = tagger.TagImages(image.ID(imageID)) |
|
| 85 | 86 |
} |
| 86 |
- err = tagger.TagImages(image.ID(imageID)) |
|
| 87 | 87 |
return imageID, err |
| 88 | 88 |
} |
| 89 | 89 |
|
| ... | ... |
@@ -207,9 +207,16 @@ func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder. |
| 207 | 207 |
frontendAttrs["no-cache"] = "" |
| 208 | 208 |
} |
| 209 | 209 |
|
| 210 |
+ exporterAttrs := map[string]string{}
|
|
| 211 |
+ |
|
| 212 |
+ if len(opt.Options.Tags) > 0 {
|
|
| 213 |
+ exporterAttrs["name"] = strings.Join(opt.Options.Tags, ",") |
|
| 214 |
+ } |
|
| 215 |
+ |
|
| 210 | 216 |
req := &controlapi.SolveRequest{
|
| 211 | 217 |
Ref: id, |
| 212 | 218 |
Exporter: "moby", |
| 219 |
+ ExporterAttrs: exporterAttrs, |
|
| 213 | 220 |
Frontend: "dockerfile.v0", |
| 214 | 221 |
FrontendAttrs: frontendAttrs, |
| 215 | 222 |
Session: opt.Options.SessionID, |
| ... | ... |
@@ -3,6 +3,7 @@ package containerimage |
| 3 | 3 |
import ( |
| 4 | 4 |
"context" |
| 5 | 5 |
"fmt" |
| 6 |
+ "strings" |
|
| 6 | 7 |
|
| 7 | 8 |
distref "github.com/docker/distribution/reference" |
| 8 | 9 |
"github.com/docker/docker/image" |
| ... | ... |
@@ -46,11 +47,13 @@ func (e *imageExporter) Resolve(ctx context.Context, opt map[string]string) (exp |
| 46 | 46 |
for k, v := range opt {
|
| 47 | 47 |
switch k {
|
| 48 | 48 |
case keyImageName: |
| 49 |
- ref, err := distref.ParseNormalizedNamed(v) |
|
| 50 |
- if err != nil {
|
|
| 51 |
- return nil, err |
|
| 49 |
+ for _, v := range strings.Split(v, ",") {
|
|
| 50 |
+ ref, err := distref.ParseNormalizedNamed(v) |
|
| 51 |
+ if err != nil {
|
|
| 52 |
+ return nil, err |
|
| 53 |
+ } |
|
| 54 |
+ i.targetNames = append(i.targetNames, ref) |
|
| 52 | 55 |
} |
| 53 |
- i.targetName = ref |
|
| 54 | 56 |
case exporterImageConfig: |
| 55 | 57 |
i.config = []byte(v) |
| 56 | 58 |
default: |
| ... | ... |
@@ -62,8 +65,8 @@ func (e *imageExporter) Resolve(ctx context.Context, opt map[string]string) (exp |
| 62 | 62 |
|
| 63 | 63 |
type imageExporterInstance struct {
|
| 64 | 64 |
*imageExporter |
| 65 |
- targetName distref.Named |
|
| 66 |
- config []byte |
|
| 65 |
+ targetNames []distref.Named |
|
| 66 |
+ config []byte |
|
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
func (e *imageExporterInstance) Name() string {
|
| ... | ... |
@@ -126,11 +129,11 @@ func (e *imageExporterInstance) Export(ctx context.Context, ref cache.ImmutableR |
| 126 | 126 |
} |
| 127 | 127 |
configDone(nil) |
| 128 | 128 |
|
| 129 |
- if e.targetName != nil {
|
|
| 130 |
- if e.opt.ReferenceStore != nil {
|
|
| 131 |
- tagDone := oneOffProgress(ctx, "naming to "+e.targetName.String()) |
|
| 129 |
+ if e.opt.ReferenceStore != nil {
|
|
| 130 |
+ for _, targetName := range e.targetNames {
|
|
| 131 |
+ tagDone := oneOffProgress(ctx, "naming to "+targetName.String()) |
|
| 132 | 132 |
|
| 133 |
- if err := e.opt.ReferenceStore.AddTag(e.targetName, digest.Digest(id), true); err != nil {
|
|
| 133 |
+ if err := e.opt.ReferenceStore.AddTag(targetName, digest.Digest(id), true); err != nil {
|
|
| 134 | 134 |
return nil, tagDone(err) |
| 135 | 135 |
} |
| 136 | 136 |
tagDone(nil) |