FROM python:3.10-slim RUN apt-get update && apt-get install -y \ build-essential \ git \ curl \ && rm -rf /var/lib/apt/lists/* RUN useradd -m appuser WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . RUN chown -R appuser:appuser /app # HuggingFace cache config ENV HF_HOME=/app/huggingface_cache ENV TRANSFORMERS_CACHE=/app/huggingface_cache RUN rm -rf /root/.cache/huggingface && mkdir -p /app/huggingface_cache && chmod -R 777 /app/huggingface_cache USER appuser EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]