# Use Python 3.10 slim image FROM python:3.10-slim # Set working directory WORKDIR /app # Install system dependencies for OpenCV and other libraries RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Create necessary directories RUN mkdir -p content Story-Generation /tmp/matplotlib_cache && \ chmod -R 777 /app && \ chmod -R 777 /tmp && \ chmod -R 777 /root # Expose Gradio default port EXPOSE 7860 # Set environment variables for Gradio ENV GRADIO_SERVER_NAME="0.0.0.0" ENV GRADIO_SERVER_PORT=7860 ENV MPLCONFIGDIR=/tmp/matplotlib_cache # Run the application CMD ["python", "app.py"]