diff --git a/newsfragments/978.bugfix b/newsfragments/978.bugfix new file mode 100644 index 0000000..6b155a3 --- /dev/null +++ b/newsfragments/978.bugfix @@ -0,0 +1 @@ +Fixed support for de-facto alternative `Dockerfile` names (e.g. `Containerfile`) diff --git a/podman_compose.py b/podman_compose.py index f424169..200ce78 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1527,12 +1527,8 @@ def normalize_service_final(service: dict, project_dir: str) -> dict: build = service["build"] context = build if is_str(build) else build.get("context", ".") context = os.path.normpath(os.path.join(project_dir, context)) - dockerfile = ( - "Dockerfile" if is_str(build) else service["build"].get("dockerfile", "Dockerfile") - ) if not is_dict(service["build"]): service["build"] = {} - service["build"]["dockerfile"] = dockerfile service["build"]["context"] = context return service diff --git a/tests/unit/test_normalize_final_build.py b/tests/unit/test_normalize_final_build.py index 6356d3e..34ba0ea 100644 --- a/tests/unit/test_normalize_final_build.py +++ b/tests/unit/test_normalize_final_build.py @@ -22,7 +22,7 @@ class TestNormalizeFinalBuild(unittest.TestCase): ( {"build": "."}, { - "build": {"context": cwd, "dockerfile": "Dockerfile"}, + "build": {"context": cwd}, }, ), ( @@ -30,7 +30,6 @@ class TestNormalizeFinalBuild(unittest.TestCase): { "build": { "context": os.path.normpath(os.path.join(cwd, "../relative")), - "dockerfile": "Dockerfile", }, }, ), @@ -39,7 +38,6 @@ class TestNormalizeFinalBuild(unittest.TestCase): { "build": { "context": os.path.normpath(os.path.join(cwd, "./relative")), - "dockerfile": "Dockerfile", }, }, ), @@ -48,7 +46,6 @@ class TestNormalizeFinalBuild(unittest.TestCase): { "build": { "context": "/workspace/absolute", - "dockerfile": "Dockerfile", }, }, ), @@ -74,7 +71,6 @@ class TestNormalizeFinalBuild(unittest.TestCase): { "build": { "context": cwd, - "dockerfile": "Dockerfile", }, }, ), @@ -135,12 +131,12 @@ class TestNormalizeFinalBuild(unittest.TestCase): ( {}, {"build": "."}, - {"build": {"context": cwd, "dockerfile": "Dockerfile"}}, + {"build": {"context": cwd}}, ), ( {"build": "."}, {}, - {"build": {"context": cwd, "dockerfile": "Dockerfile"}}, + {"build": {"context": cwd}}, ), ( {"build": "/workspace/absolute"}, @@ -148,19 +144,18 @@ class TestNormalizeFinalBuild(unittest.TestCase): { "build": { "context": os.path.normpath(os.path.join(cwd, "./relative")), - "dockerfile": "Dockerfile", } }, ), ( {"build": "./relative"}, {"build": "/workspace/absolute"}, - {"build": {"context": "/workspace/absolute", "dockerfile": "Dockerfile"}}, + {"build": {"context": "/workspace/absolute"}}, ), ( {"build": "./relative"}, {"build": "/workspace/absolute"}, - {"build": {"context": "/workspace/absolute", "dockerfile": "Dockerfile"}}, + {"build": {"context": "/workspace/absolute"}}, ), ( {"build": {"dockerfile": "test-dockerfile"}},