FROM python:3.11-slim RUN pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir "transformers==4.57.1" "sentence-transformers==5.1.2" fastapi==0.115.6 "uvicorn[standard]==0.32.1" numpy==2.1.3 requests huggingface_hub gradio_client==1.5.2 RUN useradd -m -u 1000 user USER user ENV HOME=/home/user PYTHONUNBUFFERED=1 HF_HOME=/home/user/hfcache # the model ships in the image, so a restart only fetches the index RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('Qwen/Qwen3-Embedding-0.6B')" WORKDIR /home/user/app COPY --chown=user app.py . CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]