Skip to content

Commit 6228391

Browse files
CopilotKanti
andauthored
Strip multi-stage AS alias from FROM parsing to keep literal build-context key correct
Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
1 parent cf1c785 commit 6228391

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎ci/src/FileReader.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getInfo(string $dockerfilePath)
6060
}
6161
}
6262
// Only internal images must be contained in build tree
63-
preg_match_all('/FROM (.*)/', $content, $fromMatches);
63+
preg_match_all('/^FROM\s+(\S+)(?:\s+AS\s+\S+)?\s*$/mi', $content, $fromMatches);
6464
$parentImage = array_pop($fromMatches[1]);
6565
if (strpos($parentImage, 'webdevops/') === 0) {
6666
// Real Docker image inheritance: the Dockerfile's FROM references

0 commit comments

Comments
 (0)