Spaces:
Sleeping
Sleeping
| # β Base image with Python 3.9 slim | |
| FROM python:3.9-slim | |
| # Prevent interactive prompts during package installs | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Set working directory | |
| WORKDIR /app | |
| # β Install system dependencies (needed for matplotlib, wordcloud etc.) | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| g++ \ | |
| wget \ | |
| curl \ | |
| git \ | |
| build-essential \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxrender1 \ | |
| libxext6 \ | |
| libgl1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # β Copy requirements.txt first (cache optimization) | |
| COPY requirements.txt . | |
| # β Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # β Download NLTK stopwords at build time | |
| RUN python -m nltk.downloader stopwords | |
| # β Copy the source code into container | |
| COPY . . | |
| # β Expose Streamlit port | |
| EXPOSE 7860 | |
| # β Environment variables for Streamlit | |
| ENV STREAMLIT_SERVER_PORT=7860 \ | |
| STREAMLIT_SERVER_ADDRESS=0.0.0.0 \ | |
| STREAMLIT_BROWSER_GATHERUSAGESTATS=false | |
| # β Run Streamlit app | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |