pierrejeambrun commented on code in PR #35086:
URL: https://github.com/apache/airflow/pull/35086#discussion_r1367949177


##########
dev/breeze/src/airflow_breeze/utils/cdxgen.py:
##########
@@ -217,28 +231,41 @@ def get_requirements_for_provider(
     )
 
 
-def build_all_airflow_versions_base_image(python_version: str):
+def build_all_airflow_versions_base_image(
+    python_version: str,
+    confirm: bool = True,
+):
     """
     Build an image with all airflow versions pre-installed in separate 
virtualenvs.
     """
     image_name = 
f"apache/airflow-dev/all_airflow_versions/python{python_version}"
     image_name = 
get_all_airflow_versions_image_name(python_version=python_version)
     dockerfile = f"""
 FROM ghcr.io/apache/airflow/main/ci/python{python_version}
-RUN pip install --upgrade pip
+RUN pip install --upgrade pip --no-cache-dir
 # Prevent setting sources in PYTHONPATH to not interfere with virtualenvs
 ENV USE_AIRFLOW_VERSION=none
+ENV START_AIRFLOW=none
     """
-    for airflow_version in get_active_airflow_versions():
+    compatible_airflow_versions = [
+        airflow_version
+        for airflow_version, python_versions in 
AIRFLOW_PYTHON_COMPATIBILITY_MATRIX.items()
+        if python_version in python_versions
+    ]
+
+    for airflow_version in compatible_airflow_versions:
         dockerfile += f"""
 # Create the virtualenv and install the proper airflow version in it
 RUN python -m venv /opt/airflow/airflow-{airflow_version} && \
-/opt/airflow/airflow-{airflow_version}/bin/pip install --upgrade pip && \
+/opt/airflow/airflow-{airflow_version}/bin/pip install --no-cache-dir 
--upgrade pip && \
 /opt/airflow/airflow-{airflow_version}/bin/pip install 
apache-airflow=={airflow_version} \
     --constraint https://raw.githubusercontent.com/apache/airflow/\
 constraints-{airflow_version}/constraints-{python_version}.txt
 """
-    run_command(["docker", "build", "--tag", image_name, "-"], 
input=dockerfile, text=True, check=True)
+    build_command = run_command(

Review Comment:
   Thank you for the details. I would like to do that as a follow up. I will 
just mark the conversion resolve the conversation to not make the review harder 
for other, but I saved the comment link to come back to it right after this one 
is merged.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to