1+ # ---- Package Build Stage ----
2+ FROM python:3.12.12-alpine3.23 AS package-builder
3+
4+ WORKDIR /build
5+
6+ # Copy project files needed for package build
7+ COPY pyproject.toml uv.lock ./
8+ COPY middleware ./middleware
9+
10+ # Upgrade pip and install uv
11+ RUN pip install --no-cache-dir --upgrade pip==25.3 uv==0.9.27
12+
13+ # We prefer to have a real python package for sql_to_arc that will be
14+ # installed in the next stage using uv.
15+ RUN uv build --package sql_to_arc --wheel
16+
17+
118# ---- Binary Build Stage ----
219FROM python:3.12.12-alpine3.23 AS binary-builder
320
@@ -14,15 +31,15 @@ WORKDIR /build
1431
1532# Install uv and PyInstaller
1633RUN pip install --no-cache-dir --upgrade pip==25.3 uv==0.9.27
34+ RUN uv pip install --system pyinstaller
1735
18- # Copy project files needed for package build
36+ # Copy and install built wheel from package-builder stage
37+ COPY --from=package-builder /build/dist/*.whl /tmp/wheels/
38+ RUN uv pip install --system /tmp/wheels/*.whl
39+
40+ # use uv to install dependencies for sql_to_arc that we do not have pre-built wheels for
1941COPY pyproject.toml uv.lock ./
2042COPY middleware ./middleware
21-
22- # Install PyInstaller
23- RUN uv pip install --system pyinstaller
24-
25- # Install further dependencies for sql_to_arc
2643RUN uv sync
2744
2845# Build standalone binary with PyInstaller
0 commit comments