Skip to content

Commit 7152193

Browse files
hack: allow customizing the containerfile name
In the functions that create docker buildx commands or podman build commands allow passing a custom container file. This will be used by a future change that writes a temporary edited container file that needs to be passed to the container commands. Signed-off-by: John Mulligan <[email protected]>
1 parent 572ea81 commit 7152193

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

hack/build-image

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def container_engine(cli):
204204
return _DISCOVERED_CONTAINER_ENGINES[0]
205205

206206

207-
def _buildx_build_tasks(cli, target):
207+
def _buildx_build_tasks(cli, target, containerfile=""):
208208
eng = container_engine(cli)
209209
tasks = []
210210
args = [eng, "buildx"]
@@ -230,7 +230,7 @@ def _buildx_build_tasks(cli, target):
230230
f"--platform=linux/{target.arch}",
231231
"--load",
232232
]
233-
+ create_common_container_engine_args(cli, target),
233+
+ create_common_container_engine_args(cli, target, containerfile),
234234
"check": True,
235235
}
236236
)
@@ -239,7 +239,7 @@ def _buildx_build_tasks(cli, target):
239239
return tasks
240240

241241

242-
def _common_build_tasks(cli, target):
242+
def _common_build_tasks(cli, target, containerfile=""):
243243
# podman/common build tasks
244244
eng = container_engine(cli)
245245
tasks = []
@@ -255,7 +255,8 @@ def _common_build_tasks(cli, target):
255255

256256
tasks.append(
257257
{
258-
"cmd": args + create_common_container_engine_args(cli, target),
258+
"cmd": args
259+
+ create_common_container_engine_args(cli, target, containerfile),
259260
"check": True,
260261
}
261262
)
@@ -275,7 +276,7 @@ def container_build(cli, target):
275276
run(cli, **task)
276277

277278

278-
def create_common_container_engine_args(cli, target):
279+
def create_common_container_engine_args(cli, target, containerfile=""):
279280
args = []
280281
pkgs_from = PACKAGES_FROM[target.pkg_source]
281282
if pkgs_from:
@@ -296,7 +297,7 @@ def create_common_container_engine_args(cli, target):
296297
args.append(tname)
297298

298299
args.append("-f")
299-
args.append(target_containerfile(target))
300+
args.append(containerfile or target_containerfile(target))
300301
args.append(kind_source_dir(target.name))
301302
return [str(a) for a in args]
302303

0 commit comments

Comments
 (0)