chipling commited on
Commit
25fd3ae
·
verified ·
1 Parent(s): de54083

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -10
Dockerfile CHANGED
@@ -1,22 +1,28 @@
1
- # Use the official pre-built server image
2
- FROM ghcr.io/abetlen/llama-cpp-python:latest
3
 
4
- # Set the working directory
5
  WORKDIR /app
6
 
7
- # Install huggingface_hub to download the model
 
 
 
 
 
 
 
 
 
 
8
  RUN pip install huggingface_hub
9
 
10
- # Download the model during the build process
11
- # This ensures the model is ready as soon as the container starts
12
  RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive', filename='Qwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf', local_dir='.')"
13
 
14
- # Hugging Face Spaces require the app to listen on port 7860
15
  EXPOSE 7860
16
 
17
- # Run the server with OpenAI-compatible settings
18
- # - n_threads 2: Matches the free tier's 2 vCPUs
19
- # - host 0.0.0.0: Required for external access
20
  CMD ["python3", "-m", "llama_cpp.server", \
21
  "--model", "Qwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf", \
22
  "--host", "0.0.0.0", \
 
1
+ # Use a standard Python image
2
+ FROM python:3.10-slim
3
 
 
4
  WORKDIR /app
5
 
6
+ # Install basic system tools required for the server
7
+ RUN apt-get update && apt-get install -y \
8
+ libopenblas-dev \
9
+ gcc \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install the PRE-COMPILED wheel for CPU (Skips the 'stuck' build process)
13
+ RUN pip install --no-cache-dir \
14
+ "llama-cpp-python[server] @ https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.7/llama_cpp_python-0.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
15
+
16
+ # Install huggingface_hub to fetch the model
17
  RUN pip install huggingface_hub
18
 
19
+ # Pre-download the model so it's ready on boot
 
20
  RUN python3 -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='HauhauCS/Qwen3.5-4B-Uncensored-HauhauCS-Aggressive', filename='Qwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf', local_dir='.')"
21
 
22
+ # Expose the HF Space port
23
  EXPOSE 7860
24
 
25
+ # Launch the server optimized for 2 CPUs
 
 
26
  CMD ["python3", "-m", "llama_cpp.server", \
27
  "--model", "Qwen3.5-4B-Uncensored-HauhauCS-Aggressive-Q4_K_M.gguf", \
28
  "--host", "0.0.0.0", \