| FROM python:3.12 | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| cmake \ | |
| git \ | |
| pkg-config \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip and add build tools just in case | |
| RUN pip install --no-cache-dir --upgrade pip setuptools wheel | |
| # Install python requirements | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create necessary directories | |
| RUN mkdir -p /app/data /app/frontend | |
| # Copy the rest of the application | |
| COPY backend/ /app/backend/ | |
| COPY frontend/ /app/frontend/ | |
| COPY config.py /app/config.py | |
| # Create a non-root user for Hugging Face space compatibility | |
| RUN useradd -m -u 1000 user | |
| RUN chown -R user:user /app | |
| USER user | |
| # Expose the standard port for Hugging Face spaces | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["uvicorn", "backend.server:app", "--host", "0.0.0.0", "--port", "7860"] | |