# Use Python 3.8 slim image FROM python:3.8-slim # Set the working directory WORKDIR /app # Install system dependencies for OpenCV and other tools RUN apt-get update && \ apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Expose the port that Streamlit runs on (default: 8501) EXPOSE 8501 # Create necessary directories with proper permissions RUN mkdir -p /app/flagged /app/matplotlib_cache && chmod -R 777 /app/uploads /app/flagged /app/matplotlib_cache # Set the MPLCONFIGDIR environment variable ENV MPLCONFIGDIR=/app/matplotlib_cache # Run the application on the correct port and address CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]