FROM python:3.10-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ GRADIO_SERVER_NAME="0.0.0.0" \ MPLCONFIGDIR=/tmp/matplotlib # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends build-essential && \ rm -rf /var/lib/apt/lists/* # Copy application files COPY . . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Create writable directory for Matplotlib RUN mkdir -p /tmp/matplotlib && chmod a+rwx /tmp/matplotlib # Expose the port EXPOSE 7860 # Launch the application CMD ["python", "app.py"]