zapashwin commited on
Commit
051e462
·
verified ·
1 Parent(s): 2aa6b79

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -7
Dockerfile CHANGED
@@ -2,12 +2,11 @@ FROM ghcr.io/ggml-org/llama.cpp:server
2
 
3
  USER root
4
 
5
- # Completely wipe and reinstall fresh, bypassing cached layers
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  curl \
8
- && rm -rf /models /root/.cache /tmp/* \
9
  && mkdir -p /models \
10
- && curl -L https://huggingface.co/unsloth/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_K_M.gguf -o /models/model.gguf \
11
  && chown -R 1000:1000 /models \
12
  && apt-get purge -y curl \
13
  && apt-get autoremove -y \
@@ -26,7 +25,5 @@ ENV LLAMA_ARG_BATCH_SIZE=256
26
  ENV LLAMA_ARG_UBATCH_SIZE=256
27
  ENV LLAMA_ARG_MLOCK=false
28
 
29
- HEALTHCHECK --interval=30s --timeout=15s --start-period=10s --retries=3 \
30
- CMD curl -f http://localhost:7860/health || exit 1
31
-
32
- ENTRYPOINT ["/app/llama-server"]
 
2
 
3
  USER root
4
 
5
+ # Only install curl for the startup script, no heavy downloads during build
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  curl \
8
+ && rm -rf /models \
9
  && mkdir -p /models \
 
10
  && chown -R 1000:1000 /models \
11
  && apt-get purge -y curl \
12
  && apt-get autoremove -y \
 
25
  ENV LLAMA_ARG_UBATCH_SIZE=256
26
  ENV LLAMA_ARG_MLOCK=false
27
 
28
+ # Download model on startup if it doesn't exist, then launch server
29
+ ENTRYPOINT ["sh", "-c", "if [ ! -f /models/model.gguf ]; then echo 'Downloading model fresh...'; curl -L https://huggingface.co/unsloth/Llama-3.2-1B-Instruct-GGUF/resolve/main/Llama-3.2-1B-Instruct-Q4_K_M.gguf -o /models/model.gguf; fi && exec /app/llama-server"]