# ✅ 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"]