Spaces:
Paused
Paused
| ######################## 1) BACKEND ######################## | |
| FROM python:3.10-slim AS backend | |
| WORKDIR /app | |
| COPY backend/requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY backend/ ./ | |
| ######################## 2) FRONTEND ######################## | |
| FROM node:18-alpine AS frontend | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm ci | |
| COPY frontend/ . | |
| RUN npm run build # создаёт /.next | |
| ######################## 3) FINAL IMAGE ######################## | |
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # --- bin + libs Python (включая uvicorn) --- | |
| COPY --from=backend /usr/local /usr/local | |
| # --- исходники backend (включая items.py) --- | |
| COPY --from=backend /app/ /app/ | |
| # --- статический фронт --- | |
| COPY --from=frontend /app/frontend/.next /app/frontend/.next | |
| COPY --from=frontend /app/frontend/public /app/frontend/public | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONPATH=/app | |
| ENV NEXT_PUBLIC_BACKEND_BASE_URL=/api | |
| ENV NEXT_PUBLIC_BACKEND_PORT=7860 | |
| EXPOSE 7860 | |
| CMD ["python","-m","uvicorn","backend.main:app", "--host","0.0.0.0","--port","7860", "--proxy-headers","--root-path","/api"] | |