| FROM python:3.10 | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy project files | |
| COPY . /app | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Create and set the cache directory for Hugging Face | |
| ENV TRANSFORMERS_CACHE="/app/cache" | |
| # Ensure the cache directory exists and has the correct permissions | |
| RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
| # Expose the port that the app will run on | |
| EXPOSE 7860 | |
| # Command to run the FastAPI app with Uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |