| # Use an official Python runtime | |
| FROM python:3.9-slim | |
| # Install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install supervisor for process management | |
| RUN apt-get update && apt-get install -y supervisor | |
| # Copy application files | |
| COPY . . | |
| # Expose port for Streamlit | |
| EXPOSE 8501 | |
| # Add supervisor configuration for running both Flask and Streamlit | |
| COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf | |
| # Run the supervisor to manage processes | |
| CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"] | |