FROM python:3.11-slim RUN apt-get update && apt-get install -y \ git git-lfs cmake build-essential \ libsm6 libxext6 libgl1 \ && rm -rf /var/lib/apt/lists/* \ && git lfs install WORKDIR /app ENV CMAKE_ARGS="-DGGML_BLAS=OFF -DGGML_METAL=OFF -DGGML_OPENMP=OFF -DGGML_NATIVE=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF" ENV CMAKE_BUILD_PARALLEL_LEVEL=4 ENV HF_HUB_CACHE=/app/model COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . # Pre-download GGUF model (~2.5 GB) at build time RUN python -c "\ from huggingface_hub import hf_hub_download; \ hf_hub_download(repo_id='Jackrong/Qwen3.5-4B-Neo-GGUF', filename='Qwen3.5-4B.Q4_K_S.gguf', cache_dir='/app/model')" # Pre-download embedding model at build time RUN python -c "\ from huggingface_hub import snapshot_download; \ snapshot_download('BAAI/bge-small-en-v1.5')" RUN useradd -m -u 1000 user \ && chown -R 1000:1000 /app/model USER user ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH EXPOSE 7860 CMD ["python", "app.py"]