Spaces:
Build error
Build error
| # Use a lightweight base image with Python | |
| FROM python:3.10-slim | |
| # 1. Install system dependencies (Build tools + wget) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # 2. Install llama-cpp-python with CPU wheel preference | |
| RUN pip install --no-cache-dir \ | |
| "llama-cpp-python[server]" \ | |
| --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu | |
| # 3. Download the Qwen 2.5 Coder GGUF model | |
| RUN wget https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/main/qwen2.5-coder-7b-instruct-q4_k_m.gguf | |
| # 4. Expose the port HF Spaces expects | |
| EXPOSE 7860 | |
| # 5. Run the server | |
| # Note: HF Free tier has 2 vCPUs, so --n_threads 2 is best. | |
| CMD ["python3", "-m", "llama_cpp.server", \ | |
| "--model", "qwen2.5-coder-7b-instruct-q4_k_m.gguf", \ | |
| "--host", "0.0.0.0", \ | |
| "--port", "7860", \ | |
| "--n_threads", "2", \ | |
| "--n_gpu_layers", "0", \ | |
| "--n_ctx", "4096"] |