| |
| |
| |
|
|
| FROM python:3.11-slim |
|
|
| |
| ENV PYTHONUNBUFFERED=1 |
| ENV MODEL_REPO=unsloth/Phi-4-mini-instruct-GGUF |
| ENV MODEL_FILE=Phi-4-mini-instruct-Q4_K_M.gguf |
| ENV N_CTX=8192 |
| ENV N_THREADS=2 |
| ENV HOST=0.0.0.0 |
| ENV PORT=7860 |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| build-essential \ |
| curl \ |
| git \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| WORKDIR /app |
|
|
| |
| COPY script.sh /app/script.sh |
| RUN chmod +x /app/script.sh |
|
|
| |
| RUN pip install --no-cache-dir \ |
| llama-cpp-python \ |
| --extra-index-url https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/ |
|
|
| |
| RUN pip install --no-cache-dir \ |
| fastapi \ |
| uvicorn \ |
| huggingface-hub \ |
| pydantic |
|
|
| |
| |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ |
| CMD curl -f http://localhost:7860/health || exit 1 |
|
|
| |
| CMD ["/app/script.sh"] |
|
|