# syntax=docker/dockerfile:1 FROM python:3.10-slim # Prevent Python from buffering stdout/stderr (better logs) ENV PYTHONUNBUFFERED=1 WORKDIR /home/user/app # System dependencies (minimal), and Git LFS RUN apt-get update && \ apt-get install -y --no-install-recommends git git-lfs ffmpeg libsm6 libxext6 libgl1-mesa-glx && \ rm -rf /var/lib/apt/lists/* && \ git lfs install # Upgrade pip/setuptools RUN pip install --no-cache-dir pip setuptools # Copy requirements early to leverage Docker cache COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application source COPY . . # Expose both common ports (Flask uses 8080, Streamlit uses 8501) EXPOSE 8080 8501 # Entrypoint: choose Streamlit if USE_STREAMLIT=1, otherwise run Flask app CMD if [ "$USE_STREAMLIT" = "1" ]; then \ streamlit run app.py --server.port=8501 --server.enableCORS=false; \ else \ python app.py; \ fi