11# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
2- # check=error=true
2+ # check=error=true;skip=InvalidDefaultArgInFrom
3+
4+ ARG UV_VERSION
5+
6+ # TODO (@NickLarsenNZ): Get the image into our registry
7+ FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv-image
38
49FROM local-image/shared/statsd-exporter AS statsd_exporter-builder
510
611FROM local-image/stackable-devel AS opa-authorizer-builder
712
813ARG PYTHON_VERSION
14+ ARG STACKABLE_USER_UID
915
1016COPY superset/stackable/opa-authorizer /tmp/opa-authorizer
1117
18+ COPY --from=uv-image --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
19+
1220RUN <<EOF
1321microdnf update
1422microdnf install \
1523 gcc \
16- gcc-c++ \
17- python${PYTHON_VERSION} \
18- python${PYTHON_VERSION}-devel \
19- python${PYTHON_VERSION}-pip
24+ gcc-c++
2025microdnf clean all
2126rm -rf /var/cache/yum
2227
23- pip${PYTHON_VERSION} install \
28+ uv venv --python "${PYTHON_VERSION}" --system-site-packages /stackable/app
29+ . /stackable/app/bin/activate
30+
31+ uv pip install \
2432 --no-cache-dir \
2533 --upgrade \
2634 poetry==2.1.1 \
2735 pytest==8.3.4
2836
2937cd /tmp/opa-authorizer
3038
31- poetry sync
32- poetry run pytest
33- poetry build
39+ # Warnings are disabled because they come from various third party testing libraries
40+ # that we have no control over.
41+ uv run pytest --disable-warnings
42+ uv build
3443EOF
3544
3645FROM local-image/stackable-devel AS builder
@@ -45,8 +54,9 @@ ARG UV_VERSION
4554ARG NODEJS_VERSION
4655ARG STACKABLE_USER_UID
4756
48- RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \
49- microdnf update \
57+ COPY --from=uv-image --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
58+
59+ RUN microdnf update \
5060 && microdnf install \
5161 cyrus-sasl-devel \
5262 # Needed by ./configure to work out SQLite compilation flags, see snippet [1] at the end of file
@@ -61,10 +71,6 @@ RUN microdnf module enable -y nodejs:${NODEJS_VERSION} && \
6171 libffi-devel \
6272 openldap-devel \
6373 openssl-devel \
64- python${PYTHON_VERSION} \
65- python${PYTHON_VERSION}-devel \
66- python${PYTHON_VERSION}-pip \
67- python${PYTHON_VERSION}-wheel \
6874 libpq-devel \
6975 # Needed to build Superset UI assets
7076 npm \
@@ -92,13 +98,8 @@ WORKDIR /stackable
9298# See https://github.com/hadolint/hadolint/issues/1042.
9399# hadolint ignore=DL3042
94100RUN <<EOF
95- python${PYTHON_VERSION} -m venv --system-site-packages /stackable/app
96-
97- source /stackable/app/bin/activate
98-
99- # Upgrade pip to the latest version
100- # Also install uv to get support for build constraints
101- pip install --no-cache-dir --upgrade pip setuptools==75.2.0 uv==${UV_VERSION}
101+ uv venv --python "${PYTHON_VERSION}" --system-site-packages /stackable/app
102+ . /stackable/app/bin/activate
102103
103104cd "$(/stackable/patchable --images-repo-root=src checkout superset ${PRODUCT_VERSION})"
104105
@@ -117,7 +118,7 @@ uv pip install --no-cache-dir build
117118# Build superset wheel from superset root folder
118119# This picks up the UI assets from the npm build
119120cd ..
120- python${PYTHON_VERSION} -m build --wheel
121+ uv build
121122uv pip install --no-cache-dir dist/apache_superset-*-py3-none-any.whl --constraint /tmp/constraints.txt --build-constraints /tmp/build-constraints.txt
122123
123124# Install additional dependencies
@@ -198,20 +199,27 @@ COPY --from=builder --chown=${STACKABLE_USER_UID}:0 /stackable/ ${HOME}/
198199COPY --from=statsd_exporter-builder --chown=${STACKABLE_USER_UID}:0 /statsd_exporter/statsd_exporter /stackable/statsd_exporter
199200COPY --from=statsd_exporter-builder --chown=${STACKABLE_USER_UID}:0 /statsd_exporter/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json /stackable/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json
200201
202+ COPY --from=uv-image --chown=${STACKABLE_USER_UID}:0 /uv /uvx /bin/
203+
201204RUN <<EOF
202205microdnf update
203206microdnf install \
204207 cyrus-sasl \
205208 openldap \
206209 openldap-clients \
207- openssl-libs \
208- openssl-pkcs11 \
209- "python${PYTHON_VERSION}"
210+ openssl-libs
210211
211212microdnf clean all
212213rm -rf /var/cache/yum
213214
214215chmod g=u /stackable/statsd_exporter /stackable/statsd_exporter-${SHARED_STATSD_EXPORTER_VERSION}.cdx.json
216+
217+ # There is currently no way to tell `uv` where to write to, and it assumes `$HOME` for the XDG paths.
218+ export XDG_DATA_HOME=/usr/local/share
219+ export XDG_CACHE_HOME=/var/cache
220+ uv venv --python "${PYTHON_VERSION}" --system-site-packages /stackable/app
221+ chown -R "${STACKABLE_USER_UID}:0" /stackable/app/bin
222+ . /stackable/app/bin/activate
215223EOF
216224
217225# ----------------------------------------
0 commit comments