File size: 824 Bytes
42ae0b9 4a9feb8 42ae0b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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"]
|