| # Stage 1: Build llama-cpp-python | |
| FROM python:3.11-slim as builder | |
| RUN apt-get update && apt-get install -y git build-essential cmake wget | |
| RUN pip wheel --no-cache-dir llama-cpp-python==0.1.79 -w /wheels | |
| # Stage 2: Final image | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| COPY --from=builder /wheels /wheels | |
| RUN pip install --no-cache-dir /wheels/* fastapi "uvicorn[standard]" requests | |
| COPY . /app | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |