From c753b8e2cf62b7b6820bb2ff6c30e785c48218b9 Mon Sep 17 00:00:00 2001 From: Muayyad alsadi Date: Thu, 11 Nov 2021 11:27:33 +0200 Subject: [PATCH] FIXES #167: support ContainerFile --- podman_compose.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index 279f0f6..d8e907c 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1328,11 +1328,19 @@ def build_one(compose, args, cnt): if not hasattr(build_desc, 'items'): build_desc = dict(context=build_desc) ctx = build_desc.get('context', '.') - dockerfile = os.path.join(ctx, build_desc.get("dockerfile", "Dockerfile")) + dockerfile = build_desc.get("dockerfile", None) + if dockerfile: + dockerfile = os.path.join(ctx, dockerfile) + else: + dockerfile_alts = [ + 'Containerfile', 'ContainerFile', 'containerfile', + 'Dockerfile', 'DockerFile','dockerfile', + ] + for dockerfile in dockerfile_alts: + dockerfile = os.path.join(ctx, dockerfile) + if os.path.exists(dockerfile): break if not os.path.exists(dockerfile): - dockerfile = os.path.join(ctx, build_desc.get("dockerfile", "dockerfile")) - if not os.path.exists(dockerfile): - raise OSError("Dockerfile not found in "+ctx) + raise OSError("Dockerfile not found in "+ctx) build_args = ["-t", cnt["image"], "-f", dockerfile] if "target" in build_desc: build_args.extend(["--target", build_desc["target"]])