FROM python:3.13-slim RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ cmake && \ rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt . ENV CMAKE_BUILD_PARALLEL_LEVEL=2 \ MAKEFLAGS="-j2" RUN pip install --no-cache-dir -r requirements.txt huggingface-hub COPY . . RUN python - <<'PY' import os from huggingface_hub import snapshot_download, hf_hub_download from flashrank import Ranker os.makedirs("weights", exist_ok=True) print("Downloading BGE...") snapshot_download( repo_id="BAAI/bge-small-en-v1.5", local_dir="weights/bge-small-en-v1.5", ) print("Downloading FlashRank...") Ranker( model_name="ms-marco-MiniLM-L-12-v2", cache_dir="weights", ) print("Downloading Llama...") hf_hub_download( repo_id="bartowski/Llama-3.2-1B-Instruct-GGUF", filename="Llama-3.2-1B-Instruct-Q4_K_M.gguf", local_dir="weights", local_dir_use_symlinks=False, ) src = "weights/Llama-3.2-1B-Instruct-Q4_K_M.gguf" dst = "weights/llama-3.2-1b-instruct-q4_k_m.gguf" if os.path.exists(src): os.rename(src, dst) print("All weights downloaded.") PY RUN mkdir -p generated ENV OMP_NUM_THREADS=2 \ OPENBLAS_NUM_THREADS=2 \ MKL_NUM_THREADS=2 \ TOKENIZERS_PARALLELISM=false \ PYTHONUNBUFFERED=1 EXPOSE 8501 ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]