Spaces:
Sleeping
Sleeping
| # ========================= | |
| # 1) Web build stage | |
| # ========================= | |
| FROM node:20-slim AS web_builder | |
| WORKDIR /web | |
| COPY web/package*.json ./ | |
| RUN npm install | |
| COPY web/ ./ | |
| RUN npm run build # -> outputs /web/build (per your log) | |
| # ========================= | |
| # 2) API runtime stage | |
| # ========================= | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # ---- Python deps ---- | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install --no-cache-dir -r /app/requirements.txt | |
| # ---- Copy API source ---- | |
| COPY api/ /app/api/ | |
| # ---- Copy built web assets ---- | |
| COPY --from=web_builder /web/build /app/web/build | |
| # ---- Run API (serves web build too) ---- | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"] | |