Merge pull request #2549 from tonistiigi/img-name-fix

dockerfile: fix image name when loaded named context
master
Tõnis Tiigi 2022-01-07 12:17:44 -08:00 committed by GitHub
commit ffe2301031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -839,14 +839,15 @@ func contextByName(ctx context.Context, c client.Client, name string, platform *
}
switch vv[0] {
case "docker-image":
ref := strings.TrimPrefix(vv[1], "//")
imgOpt := []llb.ImageOption{
llb.WithCustomName("[context " + name + "] " + vv[1]),
llb.WithCustomName("[context " + name + "] " + ref),
llb.WithMetaResolver(c),
}
if platform != nil {
imgOpt = append(imgOpt, llb.Platform(*platform))
}
st := llb.Image(strings.TrimPrefix(vv[1], "//"), imgOpt...)
st := llb.Image(ref, imgOpt...)
return &st, nil, nil
case "git":
st, ok := detectGitContext(v, "1")