# 1. Use Python 3.10 (The Golden Standard - Stable & Compatible) FROM python:3.10-slim-bullseye # 2. Setup User (Hugging Face Requirement) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # 3. Install Basic Tools (As Root) USER root RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ build-essential \ && rm -rf /var/lib/apt/lists/* USER user # 4. INSTALL AXIOM ENGINE (Binary Mode) # Critical: We point to the "whl/cpu" URL to download the pre-built engine. # This avoids the "Build Error" and installs in seconds. RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir \ fastapi \ uvicorn \ huggingface_hub \ python-dotenv \ pydantic \ python-telegram-bot \ llama-cpp-python \ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu # 5. Copy the Brain Script COPY --chown=user . . # 6. Launch CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]