Spaces:
Running
Running
| # --- FASE 1: Build del Frontend --- | |
| FROM node:20 AS frontend-build | |
| WORKDIR /frontend | |
| COPY frontend/package*.json ./ | |
| # Installiamo le dipendenze forzando react-markdown | |
| RUN npm install | |
| COPY frontend/ ./ | |
| # MODIFICA: saltiamo il controllo TypeScript (tsc) e facciamo solo vite build | |
| RUN npx vite build | |
| # --- FASE 2: Build del Backend (Resta uguale) --- | |
| FROM python:3.10-slim | |
| WORKDIR /code | |
| # Installazione dipendenze di sistema | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Installazione dipendenze Python | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copia tutto il codice (incluso api.py e cartelle agentLogic ecc.) | |
| COPY . . | |
| # Copia i file statici di React (dist) nella cartella 'static' del backend | |
| COPY --from=frontend-build /frontend/dist /code/static | |
| # Configurazione porta Hugging Face | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # CORRETTO: Avvio dell'app (fixato virgolette e virgole) | |
| CMD ["python", "-m", "uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"] |