FROM python:3.11-slim-bookworm AS downloader RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /models RUN pip install --no-cache-dir -U huggingface_hub RUN python3 -c 'from huggingface_hub import hf_hub_download; \ model_repo="rahul7star/gemma-gguf"; \ mmproj_repo="rahul7star/gemma-gguf"; \ hf_hub_download(repo_id=model_repo, filename="model-Ornith-1.5-9B.gguf", local_dir="/models"); \ ' FROM ghcr.io/ggml-org/llama.cpp:full RUN apt-get update && apt-get install -y --no-install-recommends \ libjemalloc2 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -d /home/llama -s /bin/bash -g root -G sudo -u 1001 llama WORKDIR /app COPY --from=downloader --chown=llama:root /models /app USER llama ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 ENV MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:0,muzzy_decay_ms:0" # ENV OMP_NUM_THREADS=2 ENV KMP_AFFINITY=granularity=fine,compact ENV OMP_WAIT_POLICY=ACTIVE ENV KMP_BLOCKTIME=infinite CMD ["--server", \ "-m", "/app/model-Ornith-1.5-9B.gguf", \ "--jinja", \ "--host", "0.0.0.0", \ "--port", "7860", \ "-t", "2", \ "-ngl" ,"0",\ "--cache-type-k", "q8_0", \ "--cache-type-v", "q8_0", \ "-c", "8192", \ "-n", "4096", \ "--verbose"]