FROM python:3.12-slim # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ python3-dev \ && rm -rf /var/lib/apt/lists/* # Install llama-cpp-python with server extras (includes FastAPI, uvicorn, etc.) RUN pip install --no-cache-dir llama-cpp-python[server] \ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu # huggingface_hub for downloading the model file RUN pip install --no-cache-dir huggingface-hub WORKDIR /app COPY . . # Download the GGUF file to /app (only if not already present) and start the server CMD python -c "from huggingface_hub import hf_hub_download; \ hf_hub_download(repo_id='bartowski/Qwen2.5-Coder-14B-Instruct-GGUF', \ filename='Qwen2.5-Coder-14B-Instruct-Q4_K_M.gguf', \ local_dir='/app', local_dir_use_symlinks=False)" \ && python -m llama_cpp.server \ --model /app/Qwen2.5-Coder-14B-Instruct-Q4_K_M.gguf \ --host 0.0.0.0 \ --port 7860 \ --n_ctx 4096 \ --n_threads 4