From 0e7c50bab9a28d68afcd4b36d977bf378a994441 Mon Sep 17 00:00:00 2001
From: Angus Lees <gus@inodes.org>
Date: Wed, 20 Oct 2021 22:39:53 +1100
Subject: [PATCH] fix(dockerfile): Support FROM --arg=$value (#12193)

---
 lib/manager/dockerfile/__fixtures__/2.Dockerfile | 2 +-
 lib/manager/dockerfile/extract.ts                | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/manager/dockerfile/__fixtures__/2.Dockerfile b/lib/manager/dockerfile/__fixtures__/2.Dockerfile
index 7d183600c4..6ea296ec1c 100644
--- a/lib/manager/dockerfile/__fixtures__/2.Dockerfile
+++ b/lib/manager/dockerfile/__fixtures__/2.Dockerfile
@@ -7,7 +7,7 @@ FROM image2:1.0.0@sha256:abcdef \
 # FROM image3
 
 FROM\
-    --platform=linux \
+    --platform=$arg \
 	# comment1
 	 image4
 
diff --git a/lib/manager/dockerfile/extract.ts b/lib/manager/dockerfile/extract.ts
index b792195379..eb0bacfae2 100644
--- a/lib/manager/dockerfile/extract.ts
+++ b/lib/manager/dockerfile/extract.ts
@@ -90,7 +90,7 @@ export function extractPackageFile(content: string): PackageFile | null {
   const stageNames: string[] = [];
 
   const fromMatches = content.matchAll(
-    /^[ \t]*FROM(?:\\\r?\n| |\t|#.*?\r?\n|[ \t]--[a-z]+=\w+?)*[ \t](?<image>\S+)(?:(?:\\\r?\n| |\t|#.*\r?\n)+as[ \t]+(?<name>\S+))?/gim // TODO #12070
+    /^[ \t]*FROM(?:\\\r?\n| |\t|#.*?\r?\n|[ \t]--[a-z]+=\S+?)*[ \t](?<image>\S+)(?:(?:\\\r?\n| |\t|#.*\r?\n)+as[ \t]+(?<name>\S+))?/gim // TODO #12070
   );
 
   for (const fromMatch of fromMatches) {
-- 
GitLab