# 1) Start from a Python slim image FROM python:3.10-slim # 2) Disable .pyc files and buffer stdout/stderr ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 # 3) Install OS-level deps RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libgl1-mesa-glx \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # 4) Set workdir and copy only dependency files first (for build caching) WORKDIR /app COPY requirements.txt ./ # 5) Install Python deps RUN pip install --upgrade pip \ && pip install --no-cache-dir -r requirements.txt # 6) Copy the rest of your code COPY . /app # 7) Expose Streamlit port EXPOSE 8501 # 8) Run your app ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]