FROM python:3.9-slim WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY src/ . # Create necessary directories with proper permissions RUN mkdir -p /app/pdf_reports && \ mkdir -p /tmp/matplotlib && \ chmod -R 755 /app && \ chmod -R 777 /tmp/matplotlib # Set environment variables for Gradio and Matplotlib ENV GRADIO_SERVER_PORT=7860 ENV GRADIO_SERVER_NAME=0.0.0.0 ENV MPLCONFIGDIR=/tmp/matplotlib # Expose both ports (8001 for backend, 7860 for frontend) EXPOSE 8001 7860 # Create startup script to run both services RUN chmod +x /app/start_app.sh CMD ["/app/start_app.sh", "gradio"]