# Use the official, precompiled llama-server image FROM ghcr.io/ggml-org/llama.cpp:server # Expose port 7860 (Hugging Face's default) EXPOSE 7860 # Redirect all caches to /tmp (which is globally writable on HF Spaces) # This prevents the permission errors when downloading GGUF files ENV LLAMA_CACHE="/tmp" ENV HF_HOME="/tmp" # Optional: Set a fallback default API Key ENV LLAMA_API_KEY="your-secure-fallback-token-here" # Corrected binary path ENTRYPOINT ["/app/llama-server"] # Run llama-server, explicitly fetching the exact GGUF file # This bypasses the automatic -hf suffix parser which failed due to naming mismatches CMD ["--hf-repo", "unsloth/LFM2-350M-GGUF", "--hf-file", "LFM2-350M-UD-Q8_K_XL.gguf", "--host", "0.0.0.0", "--port", "7860", "-c", "32768", "--threads", "2"]