FROM python:3.10-slim # Set working directory WORKDIR /app # Create a cache directory with appropriate permissions RUN mkdir -p /app/cache && chmod -R 777 /app/cache # Set environment variables for Hugging Face cache ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache ENV PORT=7860 # Copy and install requirements COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Expose port EXPOSE 7860 # Run the FastAPI application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]