| FROM python:3.10-slim | |
| # Install system dependencies needed for building C++ extensions | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| gcc \ | |
| g++ \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Upgrade pip first to handle modern wheels | |
| RUN pip install --no-cache-dir --upgrade pip | |
| COPY requirements.txt . | |
| # Use the pre-built CPU wheels to avoid long compilation times | |
| RUN pip install --no-cache-dir llama-cpp-python \ | |
| --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] |