Repository: cekit/cekit

Issue:
Support Containerfile as output
Currently only `Dockerfile` is generated. For podman and buildah `Containerfile` is natively supported. Docker supports it via the `-f` syntax. OSBS only supports `Dockerfile`.

I would suggest we provide an option to generate `Containerfile` instead of `Dockerfile`.

We could also consider changing the native defaults for podman and buildah (but the option would allow users to revert back to using `Dockerfile`)

Discussion:

Patch:
diff --git a/cekit/builder.py b/cekit/builder.py
index caab3df..c478f7f 100644
--- a/cekit/builder.py
+++ b/cekit/builder.py
@@ -78,25 +78,32 @@ class Builder(Command):
         self.run()
 
     def prepare(self) -> None:
-        if (
-            self.build_engine == "docker"
-            or self.build_engine == "buildah"
-            or self.build_engine == "podman"
-        ):
+        if self.build_engine == "buildah" or self.build_engine == "podman":
             from cekit.generator.docker import DockerGenerator as generator_impl
 
-            LOGGER.info("Generating files for {} engine".format(self.build_engine))
+            container_file: str = "Containerfile"
+        elif self.build_engine == "docker":
+            from cekit.generator.docker import DockerGenerator as generator_impl
+
+            container_file: str = "Dockerfile"
         elif self.build_engine == "osbs":
             from cekit.generator.osbs import OSBSGenerator as generator_impl
 
-            LOGGER.info("Generating files for OSBS engine")
+            container_file: str = "Dockerfile"
         else:
             raise CekitError(
                 "Unsupported generator type: '{}'".format(self.build_engine)
             )
+        LOGGER.info("Generating files for {} engine".format(self.build_engine))
+
+        if self.params.container_file:
+            container_file: str = self.params.container_file
 
         self.generator = generator_impl(
-            self.params.descriptor, self.params.target, self.params.overrides
+            self.params.descriptor,
+            self.params.target,
+            container_file,
+            self.params.overrides,
         )
 
         if CONFIG.get("common", "redhat"):
diff --git a/cekit/builders/osbs.py b/cekit/builders/osbs.py
index e11b457..9b011ac 100644
--- a/cekit/builders/osbs.py
+++ b/cekit/builders/osbs.py
@@ -387,7 +387,6 @@ class DistGit(object):
         self.repo: str = repo
         self.branch: str = branch
         self.osbs_extra: PathType = osbs_extra
-        self.dockerfile: PathType = os.path.join(self.output, "Dockerfile")
         self.noninteractive: bool = noninteractive
 
         (
diff --git a/cekit/cli.py b/cekit/cli.py
index 1287368..5e6d36a 100644
--- a/cekit/cli.py
+++ b/cekit/cli.py
@@ -97,6 +97,12 @@ def cli(descriptor, verbose, nocolor, work_dir, config, redhat, target):
     help="Do not execute the build, just generate required files.",
     is_flag=True,
 )
+@click.option(
+    "--container-file",
+    type=click.Choice(["Containerfile", "Dockerfile"]),
+    help="Override the name of the generated file for image creation. Defaults to Dockerfile for "
+    "OSBS and Docker and Containerfile for Podman and Buildah.",
+)
 @click.option(
     "--overrides",
     metavar="JSON",
@@ -110,7 +116,7 @@ def cli(descriptor, verbose, nocolor, work_dir, config, redhat, target):
     help="Path to overrides file in YAML format.",
     multiple=True,
 )
-def build(validate, dry_run, overrides):
+def build(validate, dry_run, container_file, overrides):
     """
     DESCRIPTION
 
diff --git a/cekit/generator/base.py b/cekit/generator/base.py
index a9a7d9b..4e9dbb1 100644
--- a/cekit/generator/base.py
+++ b/cekit/generator/base.py
@@ -59,7 +59,11 @@ class Generator(object):
     ODCS_HIDDEN_REPOS_FLAG = "include_unpublished_pulp_repos"
 
     def __init__(
-        self, descriptor_path: PathType, target: PathType, overrides: List[str]
+        self,
+        descriptor_path: PathType,
+        target: PathType,
+        container_file: str,
+        overrides: List[str],
     ):
         self._descriptor_path: PathType = descriptor_path
         self._overrides: List[Overrides] = []
@@ -69,6 +73,7 @@ class Generator(object):
         self.image: Optional[Image] = None
         self.builder_images: List[Image] = []
         self.images: List[Image] = []
+        self.container_file: str = container_file
 
         # If descriptor has been passed in from standard input its not a path so use current working directory
         if "-" == descriptor_path:
@@ -183,7 +188,7 @@ class Generator(object):
         self.prepare_repositories()
         self.image.remove_none_keys()
         self.image.write(os.path.join(self.target, "image.yaml"))
-        self.render_dockerfile()
+        self.render_image_file()
         self.render_help()
 
     def add_redhat_overrides(self):
@@ -363,9 +368,9 @@ class Generator(object):
 
         return RedHatOverrides(self)
 
-    def render_dockerfile(self) -> None:
-        """Renders Dockerfile to $target/image/Dockerfile"""
-        LOGGER.info("Rendering Dockerfile...")
+    def render_image_file(self) -> None:
+        """Renders Containerfile/Dockerfile to $target/image/Dockerfile or $target/image/Containerfile"""
+        LOGGER.info(f"Rendering {self.container_file}...")
 
         template_file = os.path.join(
             os.path.dirname(__file__), "..", "templates", "template.jinja"
@@ -378,13 +383,13 @@ class Generator(object):
 
         template = env.get_template(os.path.basename(template_file))
 
-        dockerfile = os.path.join(self.target, "image", "Dockerfile")
+        dockerfile = os.path.join(self.target, "image", self.container_file)
         if not os.path.exists(os.path.dirname(dockerfile)):
             os.makedirs(os.path.dirname(dockerfile))
 
         with open(dockerfile, "wb") as f:
             f.write(template.render(self.image).encode("utf-8"))
-        LOGGER.debug("Dockerfile rendered")
+        LOGGER.debug(f"{self.container_file} rendered")
 
     def render_help(self) -> None:
         """
diff --git a/cekit/generator/behave.py b/cekit/generator/behave.py
index a3d1752..20ae69d 100644
--- a/cekit/generator/behave.py
+++ b/cekit/generator/behave.py
@@ -6,9 +6,15 @@ from cekit.generator.base import Generator
 
 class BehaveGenerator(Generator):
     def __init__(
-        self, descriptor_path: PathType, target: PathType, overrides: List[str]
+        self,
+        descriptor_path: PathType,
+        target: PathType,
+        container_file: str,
+        overrides: List[str],
     ):
-        super(BehaveGenerator, self).__init__(descriptor_path, target, overrides)
+        super(BehaveGenerator, self).__init__(
+            descriptor_path, target, container_file, overrides
+        )
 
     def prepare_artifacts(self):
         pass
diff --git a/cekit/generator/docker.py b/cekit/generator/docker.py
index 8bce5d8..ec0482f 100644
--- a/cekit/generator/docker.py
+++ b/cekit/generator/docker.py
@@ -12,9 +12,15 @@ config = Config()
 
 class DockerGenerator(Generator):
     def __init__(
-        self, descriptor_path: PathType, target: PathType, overrides: List[str]
+        self,
+        descriptor_path: PathType,
+        target: PathType,
+        container_file: str,
+        overrides: List[str],
     ):
-        super(DockerGenerator, self).__init__(descriptor_path, target, overrides)
+        super(DockerGenerator, self).__init__(
+            descriptor_path, target, container_file, overrides
+        )
         self._fetch_repos = True
 
     def prepare_artifacts(self):
diff --git a/cekit/generator/osbs.py b/cekit/generator/osbs.py
index 033a111..0c3267f 100644
--- a/cekit/generator/osbs.py
+++ b/cekit/generator/osbs.py
@@ -32,10 +32,16 @@ config = Config()
 
 class OSBSGenerator(Generator):
     def __init__(
-        self, descriptor_path: PathType, target: PathType, overrides: List[str]
+        self,
+        descriptor_path: PathType,
+        target: PathType,
+        container_file: str,
+        overrides: List[str],
     ):
         self._wipe = True
-        super(OSBSGenerator, self).__init__(descriptor_path, target, overrides)
+        super(OSBSGenerator, self).__init__(
+            descriptor_path, target, container_file, overrides
+        )
 
     def init(self):
         super(OSBSGenerator, self).init()
diff --git a/docs/handbook/building/parameters.rst b/docs/handbook/building/parameters.rst
index e8fa664..ddbf573 100644
--- a/docs/handbook/building/parameters.rst
+++ b/docs/handbook/building/parameters.rst
@@ -44,3 +44,7 @@ command.
     Read more about overrides in the :doc:`/handbook/overrides` chapter.
 
     This parameter can be specified multiple times.
+
+``--container-file``
+    Override the name of the generated file for image creation. Defaults to Dockerfile for
+    OSBS and Docker and Containerfile for Podman and Buildah.


Test patch:
diff --git a/cekit/test/behave_tester.py b/cekit/test/behave_tester.py
index 572f953..6aee335 100644
--- a/cekit/test/behave_tester.py
+++ b/cekit/test/behave_tester.py
@@ -30,7 +30,10 @@ class BehaveTester(Command):
 
     def prepare(self):
         self.generator = BehaveGenerator(
-            self.params.descriptor, self.params.target, self.params.overrides
+            self.params.descriptor,
+            self.params.target,
+            "Dockerfile",
+            self.params.overrides,
         )
 
         # Handle dependencies for selected generator, if any
diff --git a/tests/test_builder.py b/tests/test_builder.py
index 9469caa..4000f52 100644
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -1046,7 +1046,7 @@ def test_podman_builder_run_with_generator(mocker):
     params = Map({"tags": []})
     run = mocker.patch.object(subprocess, "run")
     builder = create_builder_object(mocker, "podman", params)
-    builder.generator = DockerGenerator("", "", {})
+    builder.generator = DockerGenerator("", "", "", {})
     builder.generator.image = Image(
         yaml.safe_load(
             """
@@ -1088,7 +1088,7 @@ def test_buildah_builder_run_with_generator(mocker):
     params = Map({"tags": []})
     run = mocker.patch.object(subprocess, "run")
     builder = create_builder_object(mocker, "buildah", params)
-    builder.generator = DockerGenerator("", "", {})
+    builder.generator = DockerGenerator("", "", "", {})
     builder.generator.image = Image(
         yaml.safe_load(
             """
diff --git a/tests/test_dockerfile.py b/tests/test_dockerfile.py
index 2e88d99..22e1f72 100644
--- a/tests/test_dockerfile.py
+++ b/tests/test_dockerfile.py
@@ -87,7 +87,7 @@ def test_dockerfile_rendering(tmpdir, mocker, name, desc_part, exp_regex):
     mocker.patch("cekit.builders.osbs.OSBSBuilder.dependencies")
     target = str(tmpdir.mkdir("target"))
     generate(target, ["--redhat", "build", "--dry-run", "podman"], desc_part)
-    regex_dockerfile(target, exp_regex)
+    regex_dockerfile(target, exp_regex, "Containerfile")
 
 
 def test_dockerfile_docker_odcs_pulp(tmpdir, mocker):
@@ -106,7 +106,7 @@ def test_dockerfile_docker_odcs_pulp(tmpdir, mocker):
     }
 
     generate(target, ["--redhat", "build", "--dry-run", "podman"], desc_part)
-    regex_dockerfile(target, "repos/content_sets_odcs.repo")
+    regex_dockerfile(target, "repos/content_sets_odcs.repo", "Containerfile")
 
 
 def test_dockerfile_docker_odcs_rpm(tmpdir, mocker):
@@ -151,7 +151,11 @@ def test_dockerfile_docker_odcs_rpm_microdnf(tmpdir, mocker):
         }
     }
 
-    generate(target, ["build", "--dry-run", "podman"], desc_part)
+    generate(
+        target,
+        ["build", "--dry-run", "--container-file", "Dockerfile", "podman"],
+        desc_part,
+    )
     regex_dockerfile(
         target,
         "RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install -y foo-repo.rpm",
@@ -180,7 +184,11 @@ def test_dockerfile_docker_odcs_rpm_microdnf_custom_flag_1(tmpdir, mocker):
         }
     }
 
-    generate(target, ["build", "--dry-run", "podman"], desc_part)
+    generate(
+        target,
+        ["build", "--dry-run", "--container-file", "Dockerfile", "podman"],
+        desc_part,
+    )
     regex_dockerfile(target, "RUN microdnf  install -y foo-repo.rpm")
     regex_dockerfile(target, "RUN microdnf  install -y a b")
     regex_dockerfile(target, "rpm -q a b")
@@ -203,7 +211,11 @@ def test_dockerfile_docker_odcs_rpm_microdnf_custom_flag_2(tmpdir, mocker):
         }
     }
 
-    generate(target, ["build", "--dry-run", "podman"], desc_part)
+    generate(
+        target,
+        ["build", "--dry-run", "--container-file", "Dockerfile", "podman"],
+        desc_part,
+    )
     regex_dockerfile(
         target, "RUN microdnf --setopt=tsflags=nodocs install -y foo-repo.rpm"
     )
@@ -338,7 +350,7 @@ def test_dockerfile_osbs_odcs_rpm(tmpdir, mocker):
 
     generate(
         target,
-        ["build", "--dry-run", "podman"],
+        ["build", "--dry-run", "--container-file", "Dockerfile", "podman"],
         descriptor={
             "packages": {
                 "repositories": [{"name": "foo", "rpm": "foo-repo.rpm"}],
@@ -379,7 +391,15 @@ def test_default_package_manager(tmpdir):
 
     generate(
         target,
-        ["--nocolor", "-v", "build", "--dry-run", "podman"],
+        [
+            "--nocolor",
+            "-v",
+            "build",
+            "--dry-run",
+            "--container-file",
+            "Dockerfile",
+            "podman",
+        ],
         descriptor={
             "packages": {
                 "repositories": [{"name": "foo", "rpm": "foo-repo.rpm"}],
@@ -406,6 +426,8 @@ def test_dockerfile_custom_package_manager_with_overrides(tmpdir):
             "--overrides",
             '{"packages": {"install": ["b"]}}',
             "--dry-run",
+            "--container-file",
+            "Dockerfile",
             "podman",
         ],
         descriptor={
@@ -441,6 +463,8 @@ def test_dockerfile_custom_package_manager_with_overrides_overriden_again(tmpdir
             "--overrides",
             '{"packages": {"manager": "dnf", "install": ["b"]}}',
             "--dry-run",
+            "--container-file",
+            "Dockerfile",
             "podman",
         ],
         descriptor={
@@ -464,7 +488,7 @@ def test_dockerfile_osbs_odcs_rpm_microdnf(tmpdir):
 
     generate(
         target,
-        ["-v", "build", "--dry-run", "podman"],
+        ["-v", "build", "--dry-run", "--container-file", "Dockerfile", "podman"],
         descriptor={
             "packages": {
                 "manager": "microdnf",
@@ -492,7 +516,7 @@ def test_supported_package_managers(tmpdir, manager):
 
     generate(
         target,
-        ["-v", "build", "--dry-run", "podman"],
+        ["-v", "build", "--dry-run", "--container-file", "Dockerfile", "podman"],
         descriptor={
             "packages": {
                 "manager": manager,
@@ -515,7 +539,7 @@ def test_supported_package_managers_apk(tmpdir, caplog):
 
     generate(
         target,
-        ["-v", "build", "--dry-run", "podman"],
+        ["-v", "build", "--dry-run", "--container-file", "Dockerfile", "podman"],
         descriptor={
             "packages": {
                 "manager": "apk",
@@ -537,7 +561,7 @@ def test_supported_package_managers_apt(tmpdir, caplog):
 
     generate(
         target,
-        ["-v", "build", "--dry-run", "podman"],
+        ["-v", "build", "--dry-run", "--container-file", "Dockerfile", "podman"],
         descriptor={
             "packages": {
                 "manager": "apt-get",
@@ -561,7 +585,7 @@ def test_supported_package_managers_apt(tmpdir, caplog):
 def test_dockerfile_do_not_copy_modules_if_no_modules(tmpdir):
     target = str(tmpdir.mkdir("target"))
     generate(target, ["build", "--dry-run", "podman"])
-    regex_dockerfile(target, "^((?!COPY modules /tmp/scripts/))")
+    regex_dockerfile(target, "^((?!COPY modules /tmp/scripts/))", "Containerfile")
 
 
 # https://github.com/cekit/cekit/issues/406
@@ -590,7 +614,7 @@ def test_dockerfile_copy_modules_if_modules_defined(tmpdir, caplog):
         },
     )
 
-    regex_dockerfile(target, "COPY modules/foo /tmp/scripts/foo")
+    regex_dockerfile(target, "COPY modules/foo /tmp/scripts/foo", "Containerfile")
 
 
 def test_dockerfile_destination_of_artifact(mocker, tmpdir):
@@ -599,7 +623,7 @@ def test_dockerfile_destination_of_artifact(mocker, tmpdir):
     target = str(tmpdir.mkdir("target"))
     generate(
         target,
-        ["-v", "build", "--dry-run", "podman"],
+        ["-v", "build", "--dry-run", "--container-file", "Dockerfile", "podman"],
         descriptor={
             "artifacts": [
                 # URL artifact, default destination
@@ -668,6 +692,8 @@ def test_overrides_applied_to_all_multi_stage_images(tmpdir):
             "--overrides",
             '{"version": "SNAPSHOT"}',
             "--dry-run",
+            "--container-file",
+            "Dockerfile",
             "podman",
         ],
         descriptor,
@@ -706,8 +732,8 @@ def generate(image_dir, command, descriptor=None, exit_code=0):
             return yaml.safe_load(desc)
 
 
-def regex_dockerfile(image_dir, exp_regex):
-    with open(os.path.join(image_dir, "target", "image", "Dockerfile"), "r") as fd:
+def regex_dockerfile(image_dir, exp_regex, container_file="Dockerfile"):
+    with open(os.path.join(image_dir, "target", "image", container_file), "r") as fd:
         dockerfile_content = fd.read()
         regex = re.compile(exp_regex, re.MULTILINE)
         assert regex.search(dockerfile_content) is not None
diff --git a/tests/test_integ_multi_stage.py b/tests/test_integ_multi_stage.py
index d76ebf9..985ee1f 100644
--- a/tests/test_integ_multi_stage.py
+++ b/tests/test_integ_multi_stage.py
@@ -24,7 +24,7 @@ image_descriptor = {
 template_teststr = "This string does not occur in the default help.md template."
 
 
-def check_file_text(image_dir, match, filename="Dockerfile"):
+def check_file_text(image_dir, match, filename="Containerfile"):
     with open(os.path.join(image_dir, "target", "image", filename), "r") as fd:
         file_content = fd.read()
         if match in file_content:
@@ -58,7 +58,9 @@ def test_multi_stage_single_image_in_list(tmpdir):
 
     run_cekit(tmpdir, ["-v", "build", "podman"], env={"BUILDAH_LAYERS": "false"})
 
-    assert os.path.exists(os.path.join(tmpdir, "target", "image", "Dockerfile")) is True
+    assert (
+        os.path.exists(os.path.join(tmpdir, "target", "image", "Containerfile")) is True
+    )
     assert check_file_text(tmpdir, "ADD help.md /") is False
 
 
diff --git a/tests/test_unit_args.py b/tests/test_unit_args.py
index 47c2c47..349ec4e 100644
--- a/tests/test_unit_args.py
+++ b/tests/test_unit_args.py
@@ -24,6 +24,7 @@ def _get_class_by_name(clazz):
             ["--redhat", "build", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -45,6 +46,7 @@ def _get_class_by_name(clazz):
             ["--target", "custom-target", "build", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -66,6 +68,7 @@ def _get_class_by_name(clazz):
             ["--work-dir", "custom-workdir", "build", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -87,6 +90,7 @@ def _get_class_by_name(clazz):
             ["--config", "custom-config", "build", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -108,6 +112,7 @@ def _get_class_by_name(clazz):
             ["build", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -129,6 +134,7 @@ def _get_class_by_name(clazz):
             ["build", "--overrides", "foo", "--overrides-file", "bar", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -150,6 +156,7 @@ def _get_class_by_name(clazz):
             ["build", "osbs"],
             "cekit.builders.osbs.OSBSBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -175,6 +182,7 @@ def _get_class_by_name(clazz):
             ["build", "osbs", "--user", "SOMEUSER"],
             "cekit.builders.osbs.OSBSBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -200,6 +208,7 @@ def _get_class_by_name(clazz):
             ["build", "osbs", "--stage"],
             "cekit.builders.osbs.OSBSBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -225,6 +234,7 @@ def _get_class_by_name(clazz):
             ["build", "osbs", "--nowait"],
             "cekit.builders.osbs.OSBSBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -269,6 +279,7 @@ def _get_class_by_name(clazz):
             ["build", "docker", "--pull"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -289,6 +300,7 @@ def _get_class_by_name(clazz):
             ["build", "osbs"],
             "cekit.builders.osbs.OSBSBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -313,6 +325,7 @@ def _get_class_by_name(clazz):
             ["build", "docker"],
             "cekit.builders.docker_builder.DockerBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
@@ -333,6 +346,7 @@ def _get_class_by_name(clazz):
             ["build", "buildah"],
             "cekit.builders.buildah.BuildahBuilder",
             {
+                "container_file": None,
                 "descriptor": "image.yaml",
                 "verbose": False,
                 "nocolor": False,
diff --git a/tests/test_unit_generator_docker.py b/tests/test_unit_generator_docker.py
index 785ea09..9311103 100644
--- a/tests/test_unit_generator_docker.py
+++ b/tests/test_unit_generator_docker.py
@@ -73,7 +73,7 @@ def docker_generator(tmpdir, overrides=None):
 
     image_dir = str(tmpdir)
     target_dir = os.path.join(image_dir, "target")
-    yield DockerGenerator(image_dir, target_dir, overrides)
+    yield DockerGenerator(image_dir, target_dir, "", overrides)
 
 
 def setup_function():
diff --git a/tests/test_validate.py b/tests/test_validate.py
index 24ad10a..425f28c 100644
--- a/tests/test_validate.py
+++ b/tests/test_validate.py
@@ -440,7 +440,9 @@ def test_image_test_with_override_yaml_on_cmd(tmpdir):
         image_dir,
         ["-v", "build", "--overrides", overrides_descriptor, "--dry-run", "podman"],
     )
-    with open(os.path.join(image_dir, "target", "image", "Dockerfile"), "r") as _file:
+    with open(
+        os.path.join(image_dir, "target", "image", "Containerfile"), "r"
+    ) as _file:
         dockerfile = _file.read()
     assert (
         """LABEL \\
@@ -480,9 +482,11 @@ def test_module_override(tmpdir):
     assert os.path.exists(os.path.join(module_dir, "overriden"))
 
     assert not os.path.exists(os.path.join(module_dir, "original"))
-    assert not check_dockerfile_text(image_dir, "not-there")
-    assert check_dockerfile(image_dir, 'foobar="dummy"')
-    assert check_dockerfile(image_dir, 'RUN [ "sh", "-x", "/tmp/scripts/foo/script" ]')
+    assert not check_dockerfile_text(image_dir, "not-there", "Containerfile")
+    assert check_dockerfile(image_dir, 'foobar="dummy"', "Containerfile")
+    assert check_dockerfile(
+        image_dir, 'RUN [ "sh", "-x", "/tmp/scripts/foo/script" ]', "Containerfile"
+    )
 
 
 # https://github.com/cekit/cekit/issues/489
@@ -522,13 +526,17 @@ def test_override_add_module_and_packages_in_overrides(tmpdir):
     )
 
     assert check_dockerfile(
-        image_dir, "RUN yum --setopt=tsflags=nodocs install -y package1 package2 \\"
+        image_dir,
+        "RUN yum --setopt=tsflags=nodocs install -y package1 package2 \\",
+        "Containerfile",
     )
     assert check_dockerfile(
-        image_dir, 'RUN [ "sh", "-x", "/tmp/scripts/main/script_a" ]'
+        image_dir, 'RUN [ "sh", "-x", "/tmp/scripts/main/script_a" ]', "Containerfile"
     )
     assert check_dockerfile_text(
-        image_dir, "        COPY \\\n            test \\\n            /tmp/artifacts/"
+        image_dir,
+        "        COPY \\\n            test \\\n            /tmp/artifacts/",
+        "Containerfile",
     )
 
 
@@ -566,19 +574,19 @@ def test_microdnf_clean_all_cmd_present(tmpdir):
     ]
 
     for match in required_matches:
-        assert check_dockerfile(image_dir, match)
+        assert check_dockerfile(image_dir, match, "Containerfile")
 
 
-def check_dockerfile(image_dir, match):
-    with open(os.path.join(image_dir, "target", "image", "Dockerfile"), "r") as fd:
+def check_dockerfile(image_dir, match, container_file="Dockerfile"):
+    with open(os.path.join(image_dir, "target", "image", container_file), "r") as fd:
         for line in fd.readlines():
             if line.strip() == match.strip():
                 return True
     return False
 
 
-def check_dockerfile_text(image_dir, match):
-    with open(os.path.join(image_dir, "target", "image", "Dockerfile"), "r") as fd:
+def check_dockerfile_text(image_dir, match, container_file="Dockerfile"):
+    with open(os.path.join(image_dir, "target", "image", container_file), "r") as fd:
         dockerfile = fd.read()
         print("MATCH:\n{}".format(match))
         print("DOCKERFILE:\n{}".format(dockerfile))
@@ -587,9 +595,9 @@ def check_dockerfile_text(image_dir, match):
     return False
 
 
-def check_dockerfile_uniq(image_dir, match):
+def check_dockerfile_uniq(image_dir, match, container_file="Dockerfile"):
     found = False
-    with open(os.path.join(image_dir, "target", "image", "Dockerfile"), "r") as fd:
+    with open(os.path.join(image_dir, "target", "image", container_file), "r") as fd:
         for line in fd.readlines():
             if line.strip() == match.strip():
                 if found:
@@ -633,7 +641,7 @@ def test_run_override_user(tmpdir):
         ["-v", "build", "--dry-run", "--overrides-file", "overrides.yaml", "podman"],
     )
 
-    assert check_dockerfile(image_dir, "USER 4321")
+    assert check_dockerfile(image_dir, "USER 4321", "Containerfile")
 
 
 def get_res(mocker):
@@ -667,7 +675,7 @@ def test_run_load_remote_override(tmpdir, mocker):
         ],
     )
 
-    assert check_dockerfile(image_dir, "USER 4321")
+    assert check_dockerfile(image_dir, "USER 4321", "Containerfile")
     mock_urlopen.assert_called_with(
         "https://example.com/overrides.yaml", context=mocker.ANY
     )
@@ -700,7 +708,7 @@ def test_run_load_remote_file_override(tmpdir, mocker):
         ],
     )
 
-    assert check_dockerfile(image_dir, "USER 4321")
+    assert check_dockerfile(image_dir, "USER 4321", "Containerfile")
 
 
 def test_run_override_artifact(tmpdir):
@@ -726,7 +734,7 @@ def test_run_override_artifact(tmpdir):
         ["-v", "build", "--dry-run", "--overrides-file", "overrides.yaml", "podman"],
     )
 
-    assert check_dockerfile_uniq(image_dir, "bar.jar \\")
+    assert check_dockerfile_uniq(image_dir, "bar.jar \\", "Containerfile")
 
 
 def test_run_override_artifact_with_custom_original_destination(tmpdir):
@@ -752,13 +760,16 @@ def test_run_override_artifact_with_custom_original_destination(tmpdir):
         ["-v", "build", "--dry-run", "--overrides-file", "overrides.yaml", "podman"],
     )
 
-    with open(
-        os.path.join(str(tmpdir), "source", "target", "image", "Dockerfile"), "r"
-    ) as _file:
-        dockerfile = _file.read()
-    assert "/tmp/artifacts/' destination" not in dockerfile
-    assert "/tmp/destination/' destination" in dockerfile
-    assert check_dockerfile_uniq(image_dir, "bar.jar \\")
+    assert (
+        check_dockerfile_text(
+            image_dir, "/tmp/artifacts/' destination", "Containerfile"
+        )
+        is False
+    )
+    assert check_dockerfile_text(
+        image_dir, "/tmp/destination/' destination", "Containerfile"
+    )
+    assert check_dockerfile_uniq(image_dir, "bar.jar \\", "Containerfile")
 
 
 def test_run_override_artifact_with_custom_override_destination(tmpdir):
@@ -787,13 +798,16 @@ def test_run_override_artifact_with_custom_override_destination(tmpdir):
         ["-v", "build", "--dry-run", "--overrides-file", "overrides.yaml", "podman"],
     )
 
-    with open(
-        os.path.join(str(tmpdir), "source", "target", "image", "Dockerfile"), "r"
-    ) as _file:
-        dockerfile = _file.read()
-    assert "/tmp/destination/' destination" not in dockerfile
-    assert "/tmp/new-destination/' destination" in dockerfile
-    assert check_dockerfile_uniq(image_dir, "bar.jar \\")
+    assert (
+        check_dockerfile_text(
+            image_dir, "/tmp/destination/' destination", "Containerfile"
+        )
+        is False
+    )
+    assert check_dockerfile_text(
+        image_dir, "/tmp/new-destination/' destination", "Containerfile"
+    )
+    assert check_dockerfile_uniq(image_dir, "bar.jar \\", "Containerfile")
 
 
 def test_run_override_artifact_with_custom_override_example1(tmpdir, mocker, caplog):
@@ -858,7 +872,7 @@ def test_run_override_artifact_with_custom_override_example1(tmpdir, mocker, cap
     )
 
     with open(
-        os.path.join(str(tmpdir), "source", "target", "image", "Dockerfile"), "r"
+        os.path.join(str(tmpdir), "source", "target", "image", "Containerfile"), "r"
     ) as _file:
         dockerfile = _file.read()
     assert "/tmp/destination/' destination" in dockerfile
@@ -929,7 +943,7 @@ def test_run_override_artifact_with_custom_override_example2(tmpdir, mocker, cap
     )
 
     with open(
-        os.path.join(str(tmpdir), "source", "target", "image", "Dockerfile"), "r"
+        os.path.join(str(tmpdir), "source", "target", "image", "Containerfile"), "r"
     ) as _file:
         dockerfile = _file.read()
     assert "/tmp/destination/' destination" in dockerfile
@@ -1650,12 +1664,12 @@ def test_run_descriptor_stdin(tmpdir):
         input=str(image_descriptor),
     )
 
-    assert check_dockerfile(image_dir, "USER 4321")
+    assert check_dockerfile(image_dir, "USER 4321", "Containerfile")
 
 
 def run_cekit(cwd, parameters=None, message=None, env=None, input=None):
     if parameters is None:
-        parameters = ["build", "--dry-run", "podman"]
+        parameters = ["build", "--dry-run", "--container-file", "Dockerfile", "podman"]
 
     if env is None:
         env = {}