| # Use a minimal base image with Python 3.9 installed | |
| FROM python:3.9-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy dependency files first (for caching layers) | |
| COPY requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy rest of the project files | |
| COPY . . | |
| # Streamlit requires environment variable for Hugging Face Spaces | |
| ENV PORT=7860 | |
| # Expose the Hugging Face default port | |
| EXPOSE $PORT | |
| # Run Streamlit on Hugging Face default port | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |