Skip to content

Commit 538b3ba

Browse files
committed
feat(airflow/wip): use a newer uv version, and install the correct python version using it
WIP: Still need to fix the build layers, but this appears to work fine (tested the oldest and newest versions via the getting_started guide)
1 parent 5de8a0b commit 538b3ba

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

airflow/Dockerfile

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ WORKDIR /tmp/opa-auth-manager
2323

2424
RUN <<EOF
2525
microdnf update
26-
microdnf install python${PYTHON_VERSION}-pip
26+
microdnf install python3-pip
2727
microdnf clean all
2828

29-
pip${PYTHON_VERSION} install --no-cache-dir uv==${UV_VERSION}
29+
pip install --no-cache-dir uv==${UV_VERSION}
3030

3131
# This folder is required by the tests to set up an sqlite database
3232
mkdir /root/airflow
@@ -62,8 +62,7 @@ ARG AIRFLOW_EXTRAS_EXTERNAL_SERVICES=""
6262
ARG AIRFLOW_EXTRAS_LOCALLY_INSTALLED_SOFTWARE=""
6363
ARG AIRFLOW_EXTRAS_OTHER=""
6464

65-
RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \
66-
microdnf update && \
65+
RUN microdnf update && \
6766
microdnf install \
6867
cyrus-sasl-devel \
6968
# Needed for kerberos
@@ -78,10 +77,10 @@ RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \
7877
libpq-devel \
7978
openldap-devel \
8079
openssl-devel \
81-
python${PYTHON_VERSION} \
82-
python${PYTHON_VERSION}-devel \
83-
python${PYTHON_VERSION}-pip \
84-
python${PYTHON_VERSION}-wheel \
80+
python3 \
81+
python3-devel \
82+
python3-pip \
83+
# python${PYTHON_VERSION}-wheel \
8584
# The airflow odbc provider can compile without the development files (headers and libraries) (see https://github.com/stackabletech/docker-images/pull/683)
8685
unixODBC \
8786
# Needed for Airflow UI assets
@@ -111,14 +110,16 @@ AIRFLOW_EXTRAS="$AIRFLOW_EXTRAS_CORE,$AIRFLOW_EXTRAS_META,$AIRFLOW_EXTRAS_PROVID
111110
# Removing duplicates
112111
AIRFLOW_EXTRAS=$(echo "$AIRFLOW_EXTRAS" | tr ',' '\n' | awk 'NF > 0 {if (!seen[$0]++) print $0}' | tr '\n' ',' | sed 's/,$//')
113112

114-
python${PYTHON_VERSION} -m venv --system-site-packages /stackable/app
115-
116-
source /stackable/app/bin/activate
117-
113+
# TODO: Use uv ${UV_VERSION} from Nexus instead of pip
118114
# Upgrade pip to the latest version
119-
# Also install uv to get support for build constraints
115+
# Also install uv to get support for build constraints and venv for a given python version
120116
pip install --no-cache-dir --upgrade pip
121117
pip install --no-cache-dir uv==${UV_VERSION}
118+
119+
uv venv --python "${PYTHON_VERSION}" --system-site-packages /stackable/app
120+
source /stackable/app/bin/activate
121+
122+
# Another project manager
122123
uv tool install hatch
123124

124125
cd "$(/stackable/patchable --images-repo-root=src checkout airflow ${PRODUCT_VERSION})"
@@ -200,6 +201,7 @@ ARG TINI_VERSION
200201
ARG TARGETARCH
201202
ARG SHARED_STATSD_EXPORTER_VERSION
202203
ARG STACKABLE_USER_UID
204+
ARG UV_VERSION
203205

204206
LABEL name="Apache Airflow" \
205207
maintainer="info@stackable.tech" \
@@ -225,6 +227,9 @@ COPY --from=gitsync-image --chown=${STACKABLE_USER_UID}:0 /git-sync ${HOME}/git-
225227

226228
COPY airflow/licenses /licenses
227229

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/
232+
228233
# Update image and install needed packages
229234
RUN <<EOF
230235
microdnf update
@@ -242,8 +247,6 @@ microdnf install \
242247
openldap-clients \
243248
openssh-clients \
244249
openssl-libs \
245-
openssl-pkcs11 \
246-
python${PYTHON_VERSION} \
247250
socat \
248251
unixODBC
249252
microdnf clean all
@@ -253,6 +256,15 @@ rm -rf /var/cache/yum
253256
# It is used as an init alternative in the entrypoint
254257
curl -o /usr/bin/tini "https://repo.stackable.tech/repository/packages/tini/tini-${TINI_VERSION}-${TARGETARCH}"
255258

259+
# There is currently no way to tell `uv` where to write to, and it assumes `$HOME` for the XDG paths.
260+
export XDG_DATA_HOME=/usr/local/share
261+
export XDG_CACHE_HOME=/var/cache
262+
uv venv --python "${PYTHON_VERSION}" --system-site-packages /stackable/app
263+
chown -R "${STACKABLE_USER_UID}:0" /stackable/app/bin
264+
source /stackable/app/bin/activate
265+
# uv python install "${PYTHON_VERSION}" --no-cache -v
266+
# uv python pin "${PYTHON_VERSION}" --no-cache -v
267+
256268
# fix missing permissions
257269
chmod a+x /entrypoint.sh
258270
chmod a+x /run-airflow.sh

airflow/boil-config.toml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ git-sync-version = "v4.4.1"
99
s3fs-version = "2024.9.0"
1010
cyclonedx-bom-version = "6.0.0"
1111
tini-version = "0.19.0"
12-
uv-version = "0.7.8"
12+
uv-version = "0.9.10"
1313
airflow-extras-other = "async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,ldap,google,google_auth,microsoft.azure,odbc,pandas,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv,trino"
1414
opa-auth-manager = "airflow-2"
1515
nodejs-version = "20"
16+
nvm-version = "0.40.3"
1617

1718
[versions."2.10.5".local-images]
1819
"shared/statsd-exporter" = "0.28.0"
@@ -25,10 +26,11 @@ git-sync-version = "v4.4.1"
2526
s3fs-version = "2024.9.0"
2627
cyclonedx-bom-version = "6.0.0"
2728
tini-version = "0.19.0"
28-
uv-version = "0.7.8"
29+
uv-version = "0.9.10"
2930
airflow-extras-other = "async,amazon,celery,cncf.kubernetes,docker,dask,elasticsearch,ftp,grpc,hashicorp,http,ldap,google,google_auth,microsoft.azure,odbc,pandas,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv,trino"
3031
opa-auth-manager = "airflow-2"
3132
nodejs-version = "20"
33+
nvm-version = "0.40.3"
3234

3335
[versions."3.0.1".local-images]
3436
"shared/statsd-exporter" = "0.28.0"
@@ -41,10 +43,11 @@ git-sync-version = "v4.4.1"
4143
s3fs-version = "2024.9.0"
4244
cyclonedx-bom-version = "6.0.0"
4345
tini-version = "0.19.0"
44-
uv-version = "0.7.8"
46+
uv-version = "0.9.10"
4547
airflow-extras-other = "async,amazon,celery,cncf-kubernetes,docker,elasticsearch,fab,ftp,grpc,hashicorp,http,ldap,google,microsoft-azure,odbc,pandas,postgres,redis,sendgrid,sftp,slack,ssh,statsd,trino"
4648
opa-auth-manager = "airflow-3"
4749
nodejs-version = "20"
50+
nvm-version = "0.40.3"
4851

4952
[versions."3.0.6".local-images]
5053
"shared/statsd-exporter" = "0.28.0"
@@ -57,26 +60,27 @@ git-sync-version = "v4.4.1"
5760
s3fs-version = "2024.9.0"
5861
cyclonedx-bom-version = "6.0.0"
5962
tini-version = "0.19.0"
60-
uv-version = "0.7.8"
63+
uv-version = "0.9.10"
6164

6265
# Airflow extras are defined in separate lists to make them easier to check against the links below. The lists will be concatenated and duplicates removed in the dockerfile.
6366
# See https://airflow.apache.org/docs/apache-airflow/3.0.6/extra-packages-ref.html#core-airflow-extras
64-
airflow-extras-core="async,graphviz,kerberos,otel,sentry,standard,statsd"
67+
airflow-extras-core = "async,graphviz,kerberos,otel,sentry,standard,statsd"
6568

6669
# See https://airflow.apache.org/docs/apache-airflow/3.0.6/extra-packages-ref.html#meta-airflow-package-extras
67-
airflow-extras-meta="aiobotocore,cloudpickle,github-enterprise,google-auth,graphviz,ldap,leveldb,pandas,polars,rabbitmq,s3fs,saml,uv"
70+
airflow-extras-meta = "aiobotocore,cloudpickle,github-enterprise,google-auth,graphviz,ldap,leveldb,pandas,polars,rabbitmq,s3fs,saml,uv"
6871

6972
# See https://airflow.apache.org/docs/apache-airflow/3.0.6/extra-packages-ref.html#apache-software-extras
70-
airflow-extras-provider-apache="apache-beam,apache-cassandra,apache-drill,apache-druid,apache-flink,apache-hdfs,apache-hive,apache-iceberg,apache-impala,apache-kafka,apache-kylin,apache-livy,apache-pig,apache-pinot"
73+
airflow-extras-provider-apache = "apache-beam,apache-cassandra,apache-drill,apache-druid,apache-flink,apache-hdfs,apache-hive,apache-iceberg,apache-impala,apache-kafka,apache-kylin,apache-livy,apache-pig,apache-pinot"
7174

7275
# See https://airflow.apache.org/docs/apache-airflow/3.0.6/extra-packages-ref.html#external-services-extras
73-
airflow-extras-external-services="airbyte,alibaba,apprise,amazon,asana,atlassian-jira,microsoft-azure,cloudant,cohere,databricks,datadog,dbt-cloud,dingding,discord,facebook,github,google,hashicorp,openai,opsgenie,pagerduty,pgvector,pinecone,qdrant,salesforce,sendgrid,segment,slack,snowflake,tableau,tabular,telegram,vertica,weaviate,yandex,ydb,zendesk"
76+
airflow-extras-external-services = "airbyte,alibaba,apprise,amazon,asana,atlassian-jira,microsoft-azure,cloudant,cohere,databricks,datadog,dbt-cloud,dingding,discord,facebook,github,google,hashicorp,openai,opsgenie,pagerduty,pgvector,pinecone,qdrant,salesforce,sendgrid,segment,slack,snowflake,tableau,tabular,telegram,vertica,weaviate,yandex,ydb,zendesk"
7477

7578
# See https://airflow.apache.org/docs/apache-airflow/3.0.6/extra-packages-ref.html#locally-installed-software-extras
76-
airflow-extras-locally-installed-software="arangodb,celery,cncf-kubernetes,docker,edge3,elasticsearch,exasol,fab,git,github,influxdb,jenkins,mongo,microsoft-mssql,neo4j,odbc,openfaas,oracle,postgres,presto,redis,samba,singularity,teradata,trino"
79+
airflow-extras-locally-installed-software = "arangodb,celery,cncf-kubernetes,docker,edge3,elasticsearch,exasol,fab,git,github,influxdb,jenkins,mongo,microsoft-mssql,neo4j,odbc,openfaas,oracle,postgres,presto,redis,samba,singularity,teradata,trino"
7780

7881
# See https://airflow.apache.org/docs/apache-airflow/3.0.6/extra-packages-ref.html#other-extras
79-
airflow-extras-other="common-compat,common-io,common-messaging,common-sql,ftp,grpc,http,imap,jdbc,microsoft-psrp,microsoft-winrm,openlineage,opensearch,papermill,sftp,smtp,sqlite,ssh"
82+
airflow-extras-other = "common-compat,common-io,common-messaging,common-sql,ftp,grpc,http,imap,jdbc,microsoft-psrp,microsoft-winrm,openlineage,opensearch,papermill,sftp,smtp,sqlite,ssh"
8083

8184
opa-auth-manager = "airflow-3"
8285
nodejs-version = "20"
86+
nvm-version = "0.40.3"

0 commit comments

Comments
 (0)