Spaces:
Sleeping
Sleeping
File size: 1,044 Bytes
68af3c5 36ecfa1 68af3c5 36ecfa1 68af3c5 5b040fc 68af3c5 36ecfa1 68af3c5 | 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 30 31 32 33 34 35 36 | FROM python:3.11-slim
# System deps + Node.js 20
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl git \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python deps first (layer cache)
COPY requirements.txt requirements.deploy.txt ./
RUN pip install --no-cache-dir -r requirements.deploy.txt
# Pre-download the BGE-M3 model so cold starts are fast
RUN python3 -c "from FlagEmbedding import BGEM3FlagModel; BGEM3FlagModel('BAAI/bge-m3', use_fp16=False)"
# Download spacy model
RUN python3 -m spacy download en_core_web_sm
# Build the React frontend
COPY frontend/package.json frontend/package-lock.json* frontend/
RUN cd frontend && npm install
COPY frontend/ frontend/
RUN cd frontend && npm run build
# Copy remaining app code
COPY . .
# HuggingFace Spaces requires port 7860
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|