File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,22 +32,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3232 curl \
3333 && rm -rf /var/lib/apt/lists/*
3434
35- # ── Python dependencies ────────────── ───────────────────────────────
35+ # ── Python dependencies + SPA install ───────────────────────────────
3636COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
3737
3838WORKDIR /opt/surogates
3939COPY pyproject.toml ./
4040COPY surogates/ ./surogates/
4141
42+ # Place the built SPA inside the package tree *before* installing, so
43+ # setuptools bundles it into site-packages via package-data (declared
44+ # in pyproject.toml). That way ``setup_frontend()`` finds it at
45+ # Path(__file__).parent.parent / "web" / "dist" regardless of cwd.
46+ COPY --from=web-build /build/dist ./surogates/web/dist
47+
4248RUN uv venv /opt/venv \
4349 && uv pip install --python /opt/venv/bin/python . \
4450 && uv pip install --python /opt/venv/bin/python uvloop
4551
46- # ── Web SPA ──────────────────────────────────────────────────────────
47- # Bundled alongside the python package so create_app() can resolve it
48- # via Path(__file__).parent.parent / "web" / "dist".
49- COPY --from=web-build /build/dist /opt/surogates/surogates/web/dist
50-
5152ENV PATH="/opt/venv/bin:$PATH" \
5253 PYTHONUNBUFFERED=1 \
5354 PYTHONDONTWRITEBYTECODE=1
Original file line number Diff line number Diff line change @@ -54,6 +54,11 @@ build-backend = "setuptools.build_meta"
5454[tool .setuptools .packages .find ]
5555include = [" surogates*" ]
5656
57+ [tool .setuptools .package-data ]
58+ # Bundle the built web SPA so the API image can serve it from the
59+ # installed package location (site-packages/surogates/web/dist).
60+ surogates = [" web/dist/**/*" ]
61+
5762[tool .setuptools_scm ]
5863fallback_version = " 0.0.0"
5964
You can’t perform that action at this time.
0 commit comments