podman_compose.py: support "platform" property in the build command

This was already added to container_to_args() in https://github.com/containers/podman-compose/pull/470
which is used for the 'up' and 'run' commands.

Definition in the schema: https://github.com/compose-spec/compose-spec/blob/main/schema/compose-spec.json#L329

Signed-off-by: Beat Küng <beat-kueng@gmx.net>
This commit is contained in:
Beat Küng 2024-07-22 15:07:13 +02:00 committed by Povilas Kanapickas
parent dbbd695463
commit b3c49df6eb
2 changed files with 3 additions and 0 deletions

View File

@ -0,0 +1 @@
Added support for "platform" property in the build command.

View File

@ -2375,6 +2375,8 @@ async def build_one(compose, args, cnt):
if not os.path.exists(dockerfile):
raise OSError("Dockerfile not found in " + ctx)
build_args = ["-f", dockerfile, "-t", cnt["image"]]
if "platform" in cnt:
build_args.extend(["--platform", cnt["platform"]])
for secret in build_desc.get("secrets", []):
build_args.extend(get_secret_args(compose, cnt, secret, podman_is_building=True))
for tag in build_desc.get("tags", []):