FROM mambaorg/micromamba:2.9-debian12 USER root RUN mkdir -p /app && chown 1000:1000 /app USER $MAMBA_USER RUN micromamba install -y -n base -c conda-forge \ python=3.11.15 \ pip=26.2.1 \ llama-cpp-python=0.3.34 \ fastapi=0.141.1 \ pydantic=2.13.4 \ uvicorn=0.52.3 \ && micromamba clean --all --yes ARG MAMBA_DOCKERFILE_ACTIVATE=1 COPY --chown=$MAMBA_USER:$MAMBA_USER requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt && pip check ENV HF_HOME=/home/mambauser/.cache/huggingface \ PORT=7860 \ THOX_FAST_MODEL_REPO=Qwen/Qwen2.5-0.5B-Instruct-GGUF \ THOX_FAST_MODEL_REVISION=9217f5db79a29953eb74d5343926648285ec7e67 \ THOX_FAST_MODEL_FILE=qwen2.5-0.5b-instruct-q4_k_m.gguf \ THOX_FAST_POOL_SIZE=1 \ THOX_FAST_QUEUE_TIMEOUT_S=6 \ THOX_FAST_MAX_OUTPUT_TOKENS=16 \ THOX_STREAM_HEARTBEAT_S=2 \ THOX_MAX_OUTPUT_TOKENS=128 # Bake the immutable public interactive model into the image. A RUNNING Space # therefore cannot report ready while still waiting on a first-request download. RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download('Qwen/Qwen2.5-0.5B-Instruct-GGUF', 'qwen2.5-0.5b-instruct-q4_k_m.gguf', revision='9217f5db79a29953eb74d5343926648285ec7e67')" WORKDIR /app COPY --chown=$MAMBA_USER:$MAMBA_USER app.py /app/app.py COPY --chown=$MAMBA_USER:$MAMBA_USER THOXROUTE_GITHUB_SHA /app/THOXROUTE_GITHUB_SHA EXPOSE 7860 CMD ["python", "/app/app.py"]