def cmd_e2e_build_images(args):
    """Build docker images for each component e2e tests"""
    for project_dir in EXAMPLE_DIRECTORIES + TEMPLATE_DIRECTORIES:
        e2e_dir = next(project_dir.glob("**/e2e/"), None)
        if e2e_dir and os.listdir(e2e_dir):
            # Define the image tag for the docker image
            streamlit_version = args.streamlit_version if not args.streamlit_wheel_file else 'custom'
            image_tag = (
                f"component-template:py-{args.python_version}-st-{streamlit_version}-component-{project_dir.parts[-1]}"
            )
            # Build the docker image with specified build arguments
            docker_args = [
                "docker",
                "build",
                ".",
                f"--build-arg=PYTHON_VERSION={args.python_version}",
                f"--tag={image_tag}",
                "--progress=plain",
            ]
            if args.streamlit_wheel_file:
                buildcontext_path = THIS_DIRECTORY / "buildcontext"
                shutil.rmtree(buildcontext_path, ignore_errors=True)
                buildcontext_path.mkdir()
                shutil.copy(args.streamlit_wheel_file, buildcontext_path)
                docker_args.extend([
                    f"--target=e2e_whl",
                ])
            else:
                docker_args.extend([
                    f"--build-arg=STREAMLIT_VERSION={args.streamlit_version}",
                    f"--target=e2e_pip",
                ])
            run_verbose(
                docker_args,
                env={**os.environ, "DOCKER_BUILDKIT": "1"},
            )
Build docker images for each component e2e tests
dev.py