FROM python:3.12-slim # Avoid interactive prompts during build ENV DEBIAN_FRONTEND=noninteractive # Install system dependencies with libGL auto-detection RUN apt-get update && apt-get install -y --no-install-recommends \ git \ git-lfs \ ffmpeg \ libsm6 \ libxext6 \ cmake \ rsync \ && if apt-cache show libgl1 >/dev/null 2>&1; then \ apt-get install -y libgl1; \ elif apt-cache show libgl1-mesa-glx >/dev/null 2>&1; then \ apt-get install -y libgl1-mesa-glx; \ else \ echo "ERROR: Neither libgl1 nor libgl1-mesa-glx found" && exit 1; \ fi \ && rm -rf /var/lib/apt/lists/* \ && git lfs install # Copy dependency file & install Python packages COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy source code COPY . /app WORKDIR /app # Default command (Gradio, Streamlit, or Python) CMD ["python", "app.py"]