| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies (including libgl1 for OpenCV) | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| build-essential \ | |
| curl \ | |
| software-properties-common \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy Python dependencies | |
| COPY requirements.txt . | |
| # Install Python packages | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app source code | |
| COPY src/ ./src/ | |
| # Expose Streamlit's default port | |
| EXPOSE 8501 | |
| # Health check for Hugging Face | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 | |
| # Run the Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"] | |