FROM vllm/vllm-openai:v0.21.0 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 # Expose default HF port ENV HF_PORT=7860 EXPOSE 7860 # HF Spaces runs containers as uid 1000 — create the user and home dir. RUN useradd -m -u 1000 user || true WORKDIR /app # Copy requirements.txt and install python dependencies COPY --chown=user requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # Copy codebase COPY --chown=user . /app/ # Switch to non-root user for runtime (required by HF Spaces) USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH ENTRYPOINT [] CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]