FROM python:3.10-slim WORKDIR /app RUN apt-get update && apt-get install -y \ build-essential libglib2.0-0 libsm6 libxrender1 libxext6 \ && rm -rf /var/lib/apt/lists/* # copy everything in COPY . . # upgrade pip and install deps RUN python -m pip install --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # Hugging Face cache RUN mkdir -p /app/hf_home && chmod -R 777 /app/hf_home ENV HF_HOME=/app/hf_home EXPOSE 7860 # IMPORTANT: 1 worker only, otherwise your global buffer breaks CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]