From 5f4fc4618cb3730e047495c181f867c9e4606fed Mon Sep 17 00:00:00 2001 From: Monika Kairaityte Date: Tue, 18 Mar 2025 21:19:48 +0200 Subject: [PATCH] Add os.path.normpath to normalize dockerfile pathname Signed-off-by: Monika Kairaityte --- podman_compose.py | 2 ++ tests/unit/test_container_to_build_args.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index 018e513..be9d93a 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -2542,6 +2542,8 @@ def container_to_build_args(compose, cnt, args, path_exists, cleanup_callbacks=N break if not path_exists(dockerfile): raise OSError("Dockerfile not found in " + ctx) + + dockerfile = os.path.normpath(os.path.join(ctx, dockerfile)) build_args = ["-f", dockerfile, "-t", cnt["image"]] if "platform" in cnt: build_args.extend(["--platform", cnt["platform"]]) diff --git a/tests/unit/test_container_to_build_args.py b/tests/unit/test_container_to_build_args.py index f06a34d..885d69c 100644 --- a/tests/unit/test_container_to_build_args.py +++ b/tests/unit/test_container_to_build_args.py @@ -46,7 +46,7 @@ class TestContainerToBuildArgs(unittest.TestCase): args, [ '-f', - './Containerfile', + 'Containerfile', '-t', 'new-image', '--no-cache', @@ -67,7 +67,7 @@ class TestContainerToBuildArgs(unittest.TestCase): args, [ '-f', - './Containerfile', + 'Containerfile', '-t', 'new-image', '--platform', @@ -90,7 +90,7 @@ class TestContainerToBuildArgs(unittest.TestCase): args, [ '-f', - './Containerfile', + 'Containerfile', '-t', 'new-image', '-t', @@ -115,7 +115,7 @@ class TestContainerToBuildArgs(unittest.TestCase): args, [ '-f', - './Containerfile', + 'Containerfile', '-t', 'new-image', '--label', @@ -141,7 +141,7 @@ class TestContainerToBuildArgs(unittest.TestCase): args, [ '-f', - './Containerfile', + 'Containerfile', '-t', 'new-image', '--no-cache',