FROM python:3.11-slim # Environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ TRANSFORMERS_CACHE=/app/cache \ HF_HOME=/app/cache \ MPLCONFIGDIR=/tmp WORKDIR /app # Copy the requirements file COPY requirements.txt /app/ # Upgrade pip RUN pip install --upgrade pip # (Optional) Install any necessary system dependencies #RUN apt-get update && apt-get install -y gcc libjpeg-dev zlib1g-dev && \ # rm -rf /var/lib/apt/lists/* # Install dependencies RUN pip install --no-cache-dir -r requirements.txt # Create cache directory and set permissions RUN mkdir -p /app/cache && chmod -R 777 /app/cache RUN chmod -R 777 /app # Copy the application code COPY . /app/ ENV FLASK_APP=app.py \ FLASK_ENV=production EXPOSE 7860 CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]