| # Use an official Python runtime | |
| FROM python:3.9-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the requirements file | |
| COPY requirements.txt . | |
| # Change permission /cache/huggingface | |
| RUN mkdir -p /cache/matplotlib \ | |
| && chmod -R 777 /cache/matplotlib | |
| # Set environment variables for Hugging Face and Matplotlib | |
| ENV HF_HOME=/data/.huggingface | |
| ENV MPLCONFIGDIR=/tmp/cache/matplotlib | |
| ENV HF_TOKEN=ZGV0ZWNULWVkM!XRzLWluLUAxLWdlbmVyQHRlZC10RXh0@ | |
| # Flask | |
| ENV FLASK_APP=app.py | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the app | |
| COPY . . | |
| # Expose the Flask port | |
| EXPOSE 7860 | |
| # Run the application | |
| CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"] |