updated dockerfile

#1
by sxandie - opened
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a slim Python image
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONUNBUFFERED=1 \
6
+ PORT=7860 \
7
+ BACKEND=llama_cpp \
8
+ MODEL_DIR=/code/model
9
+
10
+ # Set working directory
11
+ WORKDIR /code
12
+
13
+ # Install basic runtime dependencies (git is useful for huggingface_hub downloads)
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ git \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ # Install llama-cpp-python using the pre-compiled CPU wheels index
19
+ RUN pip install --no-cache-dir llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
20
+
21
+ # Copy requirements and install remaining python packages
22
+ COPY requirements.txt .
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Pre-download the Gemma 1.1 2B model GGUF so the container boots instantly
26
+ RUN mkdir -p /code/model && \
27
+ python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='bartowski/gemma-1.1-2b-it-GGUF', filename='gemma-1.1-2b-it-Q4_K_M.gguf', local_dir='/code/model', local_dir_use_symlinks=False)"
28
+
29
+ # Copy the application source code
30
+ COPY . .
31
+
32
+ # Expose Gradio's port
33
+ EXPOSE 7860
34
+
35
+ # Launch the Gradio app
36
+ CMD ["python", "app.py"]