FROM python:3.10-slim-bullseye # set working directory WORKDIR /app # copy requirements and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # copy all app files COPY . . # --- create a writable cache directory --- RUN mkdir -p /app/cache/huggingface && chmod -R 777 /app/cache # --- set all relevant cache environment variables --- ENV HF_HOME=/app/cache/huggingface ENV TRANSFORMERS_CACHE=/app/cache/huggingface ENV SENTENCE_TRANSFORMERS_HOME=/app/cache/huggingface ENV HF_DATASETS_CACHE=/app/cache/huggingface EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]