From e1089414cbb98b4192a99ba53a79d9d0aa8447e8 Mon Sep 17 00:00:00 2001 From: Mick van Gelderen Date: Wed, 10 Jul 2024 18:34:45 +0200 Subject: [PATCH] fix: prevent panic when image name and stage alias are the same (#3245) --- pkg/dockerfile/dockerfile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/dockerfile/dockerfile.go b/pkg/dockerfile/dockerfile.go index 2a4d77454c..03c51b787f 100644 --- a/pkg/dockerfile/dockerfile.go +++ b/pkg/dockerfile/dockerfile.go @@ -74,7 +74,7 @@ func baseImageIndex(currentStage int, stages []instructions.Stage) int { currentStageBaseName := strings.ToLower(stages[currentStage].BaseName) for i, stage := range stages { - if i > currentStage { + if i >= currentStage { break } if stage.Name == currentStageBaseName {