We have a number of "in_container" scripts written in Bash, They are doing a number of houseekeeping stuff but since we already have Python 3.7+ inside the CI image, we could modularise them more and make them run from external and simplify entrypoint_ci (for example separate script for tests).
capture_output=not get_verbose(),
        check=False,
    )
    if result.returncode != 0:
        get_console().print("[error]Error compiling assets[/]")
        get_console().print(result.stdout)
        get_console().print(result.stderr)
        fix_ownership_using_docker()
        sys.exit(result.returncode)
    get_console().print("[success]compiled assets in docker container\n")
    get_console().print("[info]Fixing ownership of compiled assets\n")
    fix_ownership_using_docker()
    get_console().print("[success]Fixing ownership of compiled assets\n")
@release_management.command(
    name="prepare-airflow-package",
    help="Prepare sdist/whl package of Airflow.",
)
@option_package_format
@click.option(
    "--use-container-for-assets-compilation",
    is_flag=True,
    help="If set, the assets are compiled in docker container. On MacOS, asset compilation in containers "
    "is slower, due to slow mounted filesystem and number of node_module files so by default asset "
    "compilation is done locally. This option is useful for officially building packages by release "
    "manager on MacOS to make sure it is a reproducible build.",
)
@option_version_suffix_for_pypi
@option_verbose
@option_dry_run
def prepare_airflow_packages(