From 520da6f241c5ff51ef92c022479c12cdbc0699ef Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Tue, 1 Mar 2022 21:29:52 -0800 Subject: [PATCH] dockerfile: check named context for default platform if none set Signed-off-by: Tonis Tiigi --- frontend/dockerfile/builder/build.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/dockerfile/builder/build.go b/frontend/dockerfile/builder/build.go index 18eb697f..74e60c6e 100644 --- a/frontend/dockerfile/builder/build.go +++ b/frontend/dockerfile/builder/build.go @@ -819,6 +819,10 @@ func contextByNameFunc(c client.Client, p *ocispecs.Platform) func(context.Conte } name = strings.TrimSuffix(reference.FamiliarString(named), ":latest") + if p == nil { + pp := platforms.Normalize(platforms.DefaultSpec()) + p = &pp + } if p != nil { name := name + "::" + platforms.Format(platforms.Normalize(*p)) st, img, err := contextByName(ctx, c, name, p)