FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ && rm -rf /var/lib/apt/lists/* # Install dependencies COPY requirements.txt . RUN pip cache purge && pip install --no-cache-dir -r requirements.txt # Copy source code COPY app.py . # Create cache directories and set permissions RUN mkdir -p /app/cache /app/cache/matplotlib && chmod -R 777 /app/cache # Set env vars ENV HF_HOME=/app/cache \ MPLCONFIGDIR=/app/cache/matplotlib \ PYTHONUNBUFFERED=1 \ PYTHONWARNINGS=ignore::FutureWarning,ignore::UserWarning:torch._utils EXPOSE 7860 CMD ["python", "app.py"]