| # Use an official Python runtime as a parent image | |
| FROM python:3.10 | |
| # Set environment variable for cache directory | |
| ENV HF_HOME=/app/.cache | |
| #ENV TRANSFORMERS_CACHE=/app/.cache | |
| # Set the working directory to /app | |
| WORKDIR /app | |
| # Copy the requirements.txt file into the container at /app | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code into the container at /app, including the .cache folder | |
| COPY . /app | |
| # Ensure the .cache folder is writable | |
| RUN chmod -R 777 /app/.cache | |
| RUN chmod 777 api_logs.jsonl | |
| # Expose port 7860 for the app | |
| EXPOSE 7860 | |
| # Run the FastAPI app with uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |