# --- Frontend Build Stage --- FROM node:20-slim AS frontend-builder WORKDIR /app/frontend COPY frontend/package*.json ./ RUN npm install COPY frontend/ ./ RUN npm run build # --- Final Image Stage --- FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Copy the built frontend from the builder stage COPY --from=frontend-builder /app/frontend/dist ./frontend/dist # Expose port 7860 (Hugging Face default) EXPOSE 7860 # Command to run the application # We run from the backend directory to ensure app:app pathing is correct CMD ["python", "backend/app.py"]