# Stage 1: Compile frontend distribution FROM node:20-alpine AS frontend-builder WORKDIR /app COPY package.json package-lock.json* ./ RUN npm install --no-audit --no-fund COPY . . RUN npm run build # Stage 2: Fast, stable Python deployment engine FROM python:3.10-slim WORKDIR /app # Install git for the Point-to-Point repository pipeline RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* # Install required Python execution dependencies RUN pip install --no-cache-dir \ fastapi \ uvicorn \ huggingface_hub \ requests \ python-multipart # Copy the compiled website panels from Stage 1 directly into Python's space COPY --from=frontend-builder /app/dist ./dist # Copy the backend server and the Space templates it renders COPY server.py . COPY templates ./templates # Boot the app over the mandatory Hugging Face port 7860 EXPOSE 7860 CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]