FROM python:3.10-slim # Install system packages RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /code # Set transformers cache directory to a writable path ENV TRANSFORMERS_CACHE=/code/cache # Copy requirements and install COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy app code COPY app ./app # Create cache directory with permissions RUN mkdir -p /code/cache && chmod -R 777 /code/cache # Expose port EXPOSE 7860 # Start FastAPI with uvicorn CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]