Skip to content

Commit ccc9669

Browse files
committed
chore(airflow): replace python/pip package installations with uv for consistency
1 parent fa263be commit ccc9669

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

airflow/Dockerfile

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44
# - SecretsUsedInArgOrEnv : OPA_AUTH_MANAGER is a false positive and breaks the build.
55

66
ARG GIT_SYNC_VERSION
7+
ARG UV_VERSION
78

89
# For updated versions check https://github.com/kubernetes/git-sync/releases
910
# which should contain a image location (e.g. registry.k8s.io/git-sync/git-sync:v3.6.8)
1011
FROM oci.stackable.tech/sdp/git-sync/git-sync:${GIT_SYNC_VERSION} AS gitsync-image
1112

13+
# TODO (@NickLarsenNZ): Get the image into our registry
14+
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv-image
15+
1216
FROM local-image/shared/statsd-exporter AS statsd_exporter-builder
1317

1418
FROM local-image/vector AS opa-auth-manager-builder
1519

1620
ARG OPA_AUTH_MANAGER
1721
ARG PYTHON_VERSION
18-
ARG UV_VERSION
22+
ARG STACKABLE_USER_UID
1923

2024
COPY airflow/opa-auth-manager/${OPA_AUTH_MANAGER} /tmp/opa-auth-manager
2125

2226
WORKDIR /tmp/opa-auth-manager
2327

24-
RUN <<EOF
25-
microdnf update
26-
microdnf install python3-pip
27-
microdnf clean all
28-
29-
pip install --no-cache-dir uv==${UV_VERSION}
28+
COPY --from=uv-image --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
3029

30+
RUN <<EOF
3131
# This folder is required by the tests to set up an sqlite database
3232
mkdir /root/airflow
3333

@@ -46,7 +46,6 @@ ARG STACKABLE_USER_UID
4646
ARG NODEJS_VERSION
4747
ARG S3FS_VERSION
4848
ARG CYCLONEDX_BOM_VERSION
49-
ARG UV_VERSION
5049

5150
# Airflow "extras" packages are listed here: https://airflow.apache.org/docs/apache-airflow/stable/extra-packages-ref.html
5251
# They evolve over time and thus belong to the version-specific arguments.
@@ -62,6 +61,8 @@ ARG AIRFLOW_EXTRAS_EXTERNAL_SERVICES=""
6261
ARG AIRFLOW_EXTRAS_LOCALLY_INSTALLED_SOFTWARE=""
6362
ARG AIRFLOW_EXTRAS_OTHER=""
6463

64+
COPY --from=uv-image --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
65+
6566
RUN microdnf update && \
6667
microdnf install \
6768
cyrus-sasl-devel \
@@ -77,9 +78,9 @@ RUN microdnf update && \
7778
libpq-devel \
7879
openldap-devel \
7980
openssl-devel \
80-
python3 \
81-
python3-devel \
82-
python3-pip \
81+
# python3 \
82+
# python3-devel \
83+
# python3-pip \
8384
# python${PYTHON_VERSION}-wheel \
8485
# The airflow odbc provider can compile without the development files (headers and libraries) (see https://github.com/stackabletech/docker-images/pull/683)
8586
unixODBC \
@@ -110,12 +111,6 @@ AIRFLOW_EXTRAS="$AIRFLOW_EXTRAS_CORE,$AIRFLOW_EXTRAS_META,$AIRFLOW_EXTRAS_PROVID
110111
# Removing duplicates
111112
AIRFLOW_EXTRAS=$(echo "$AIRFLOW_EXTRAS" | tr ',' '\n' | awk 'NF > 0 {if (!seen[$0]++) print $0}' | tr '\n' ',' | sed 's/,$//')
112113

113-
# TODO: Use uv ${UV_VERSION} from Nexus instead of pip
114-
# Upgrade pip to the latest version
115-
# Also install uv to get support for build constraints and venv for a given python version
116-
pip install --no-cache-dir --upgrade pip
117-
pip install --no-cache-dir uv==${UV_VERSION}
118-
119114
uv venv --python "${PYTHON_VERSION}" --system-site-packages /stackable/app
120115
source /stackable/app/bin/activate
121116

@@ -201,7 +196,6 @@ ARG TINI_VERSION
201196
ARG TARGETARCH
202197
ARG SHARED_STATSD_EXPORTER_VERSION
203198
ARG STACKABLE_USER_UID
204-
ARG UV_VERSION
205199

206200
LABEL name="Apache Airflow" \
207201
maintainer="info@stackable.tech" \
@@ -227,8 +221,7 @@ COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync ${HOME}/git-
227221

228222
COPY airflow/licenses /licenses
229223

230-
# TODO (@NickLarsenNZ): Get the image into our registry
231-
COPY --from=ghcr.io/astral-sh/uv:0.9.10 --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
224+
COPY --from=uv-image --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
232225

233226
# Update image and install needed packages
234227
RUN <<EOF

0 commit comments

Comments
 (0)