| # Use a smaller base image | |
| FROM python:3.9-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| make \ | |
| libffi-dev \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy only requirements first for caching | |
| COPY requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the app files | |
| COPY app.py . | |
| # Expose the port that Streamlit runs on | |
| EXPOSE 8501 | |
| # Run the app | |
| CMD ["streamlit", "run", "app.py"] | |