FROM python:3.11-slim # Install Node.js 22 for building the frontend RUN apt-get update && apt-get install -y curl && \ curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt-get install -y nodejs && \ npm install -g pnpm@9.15.0 && \ apt-get clean && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copy and install Python dependencies first (layer cache) COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy frontend source and build it COPY frontend/ ./frontend/ RUN cd frontend && pnpm install --frozen-lockfile && pnpm build # Copy the FastAPI app (static/ was built into api/static/ by vite) COPY api/ ./api/ # HF Spaces runs on port 7860 EXPOSE 7860 # Run the FastAPI server WORKDIR /app/api CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]