Spaces:
Running
Running
Bake model at build; keep llama-server ENTRYPOINT
Browse files- Dockerfile +12 -3
Dockerfile
CHANGED
|
@@ -1,8 +1,17 @@
|
|
| 1 |
FROM ghcr.io/ggerganov/llama.cpp:server
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
EXPOSE 7860
|
|
|
|
| 6 |
CMD ["-m","/models/model.gguf","-c","2048","-ngl","0","-t","4","--host","0.0.0.0","--port","7860"]
|
| 7 |
-
ENTRYPOINT ["/bin/sh","-lc"]
|
| 8 |
-
CMD ["test -f /models/model.gguf || (mkdir -p /models && curl -fL --retry 5 --retry-delay 2 -o /models/model.gguf https://huggingface.co/bartowski/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf); exec llama-server -m /models/model.gguf -c 2048 -ngl 0 -t 4 --host 0.0.0.0 --port 7860"]
|
|
|
|
| 1 |
FROM ghcr.io/ggerganov/llama.cpp:server
|
| 2 |
|
| 3 |
+
# ensure curl exists (covers Debian/Ubuntu or Alpine bases)
|
| 4 |
+
RUN set -eux; \
|
| 5 |
+
if command -v curl >/dev/null 2>&1; then :; \
|
| 6 |
+
elif command -v apk >/dev/null 2>&1; then apk add --no-cache curl ca-certificates; \
|
| 7 |
+
elif command -v apt-get >/dev/null 2>&1; then apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/*; \
|
| 8 |
+
else echo "no supported pkg manager" && exit 1; fi
|
| 9 |
+
|
| 10 |
+
# bake tiny model into the image (fail build if download fails)
|
| 11 |
+
RUN mkdir -p /models && \
|
| 12 |
+
curl -fL --retry 5 --retry-delay 2 -o /models/model.gguf \
|
| 13 |
+
https://huggingface.co/bartowski/Qwen2.5-0.5B-Instruct-GGUF/resolve/main/Qwen2.5-0.5B-Instruct-Q4_K_M.gguf
|
| 14 |
|
| 15 |
EXPOSE 7860
|
| 16 |
+
# base image ENTRYPOINT is already ["llama-server"]; pass only args:
|
| 17 |
CMD ["-m","/models/model.gguf","-c","2048","-ngl","0","-t","4","--host","0.0.0.0","--port","7860"]
|
|
|
|
|
|