Spaces:
Sleeping
Sleeping
| # ===================================================== | |
| # AI Executive Operations Manager | |
| # Single-container build: React frontend + FastAPI backend | |
| # Port: 7860 | |
| # ===================================================== | |
| # Stage 1: Build React frontend | |
| FROM node:18-slim AS frontend-builder | |
| WORKDIR /app/frontend | |
| # Install dependencies first (cached layer) | |
| COPY frontend/package.json frontend/package-lock.json* ./ | |
| RUN npm install --legacy-peer-deps | |
| # Copy source and build | |
| COPY frontend/ ./ | |
| ENV GENERATE_SOURCEMAP=false | |
| RUN npm run build | |
| # Stage 2: Python runtime | |
| FROM python:3.11-slim AS runtime | |
| WORKDIR /app | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY env/ ./env/ | |
| COPY app.py inference.py openenv.yaml ./ | |
| # Copy pre-built React frontend from Stage 1 | |
| COPY --from=frontend-builder /app/frontend/build ./frontend/build | |
| # Expose port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ | |
| CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860/reset')" || exit 1 | |
| # Start FastAPI server | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] | |