Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +35 -0
Dockerfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ghcr.io/ggml-org/llama.cpp:full
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
RUN apt update && apt install -y python3 python3-pip python3-venv curl
|
| 6 |
+
|
| 7 |
+
RUN python3 -m venv /opt/venv
|
| 8 |
+
ENV PATH="/opt/venv/bin:$PATH"
|
| 9 |
+
|
| 10 |
+
RUN pip install -U pip huggingface_hub gradio requests
|
| 11 |
+
|
| 12 |
+
# Download SmolLM2-1.7B-Instruct GGUF (Q4_K_M ~1GB, runs well on free CPU)
|
| 13 |
+
RUN python3 -c '\
|
| 14 |
+
from huggingface_hub import hf_hub_download; \
|
| 15 |
+
hf_hub_download(\
|
| 16 |
+
repo_id="bartowski/SmolLM2-1.7B-Instruct-GGUF", \
|
| 17 |
+
filename="SmolLM2-1.7B-Instruct-Q4_K_M.gguf", \
|
| 18 |
+
local_dir="/app"\
|
| 19 |
+
)'
|
| 20 |
+
|
| 21 |
+
COPY app.py /app/app.py
|
| 22 |
+
|
| 23 |
+
# Start llama.cpp server in background, then launch Gradio
|
| 24 |
+
CMD bash -c '\
|
| 25 |
+
/llama-server \
|
| 26 |
+
-m /app/SmolLM2-1.7B-Instruct-Q4_K_M.gguf \
|
| 27 |
+
--host 0.0.0.0 \
|
| 28 |
+
--port 8080 \
|
| 29 |
+
-t 2 \
|
| 30 |
+
-c 4096 \
|
| 31 |
+
-n 2048 \
|
| 32 |
+
--log-disable &
|
| 33 |
+
sleep 10 && \
|
| 34 |
+
python3 /app/app.py\
|
| 35 |
+
'
|