Skip to content
Permalink
Browse files
Allows to specify different Python base image when building images (#…
…24634)

Today Python released new images that seems to break some of
our dependencies (at least on M1/ARM). This PR adds a workaround
possibility to add --python-image option to override the
default, latest image with any other version released previously
until we diagnose and fix the real issue.
  • Loading branch information
potiuk committed Jun 24, 2022
1 parent 4076530 commit d6e6e7d2979e7a3c71d9b9a036630def0f9432f5
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 312 deletions.
@@ -56,6 +56,7 @@
option_pull_image,
option_push_image,
option_python,
option_python_image,
option_python_versions,
option_run_in_parallel,
option_runtime_apt_command,
@@ -127,6 +128,7 @@
"--install-providers-from-sources",
"--airflow-constraints-mode",
"--airflow-constraints-reference",
"--python-image",
"--additional-python-deps",
"--runtime-apt-deps",
"--runtime-apt-command",
@@ -253,6 +255,7 @@ def run_build_in_parallel(
@option_dev_apt_command
@option_dev_apt_deps
@option_force_build
@option_python_image
@option_runtime_apt_command
@option_runtime_apt_deps
@option_airflow_constraints_mode_ci
@@ -55,6 +55,7 @@
option_pull_image,
option_push_image,
option_python,
option_python_image,
option_python_versions,
option_run_in_parallel,
option_runtime_apt_command,
@@ -118,6 +119,7 @@
"--airflow-extras",
"--airflow-constraints-mode",
"--airflow-constraints-reference",
"--python-image",
"--additional-python-deps",
"--additional-extras",
"--additional-runtime-apt-deps",
@@ -301,6 +303,7 @@ def run_build_in_parallel(
@option_additional_runtime_apt_command
@option_dev_apt_command
@option_dev_apt_deps
@option_python_image
@option_runtime_apt_command
@option_runtime_apt_deps
@option_tag_as_latest
@@ -59,6 +59,7 @@ class CommonBuildParams:
install_providers_from_sources: bool = False
platform: str = DOCKER_DEFAULT_PLATFORM
prepare_buildx_cache: bool = False
python_image: Optional[str] = None
push_image: bool = False
python: str = "3.7"
runtime_apt_command: str = ""
@@ -111,7 +112,8 @@ def docker_cache_directive(self) -> List[str]:
@property
def python_base_image(self):
"""Construct Python Base Image"""
# ghcr.io/apache/airflow/main/python:3.8-slim-bullseye
if self.python_image is not None:
return self.python_image
return f'python:{self.python}-slim-{self.debian_version}'

@property
@@ -441,3 +441,10 @@
is_flag=True,
envvar='PULL_IMAGE',
)

option_python_image = click.option(
'--python-image',
help="If specified this is the base python image used to build the image. "
"Should be something like: python:VERSION-slim-bullseye",
envvar='PYTHON_IMAGE',
)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d6e6e7d

Please sign in to comment.