| # Use a stable Debian 12 (Bookworm) base image | |
| FROM python:3.10-slim-bookworm | |
| # Install system dependencies | |
| # We replace 'libgl1-mesa-glx' (which fails) with 'libgl1' (the correct one) | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| git-lfs \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| cmake \ | |
| rsync \ | |
| libgl1 \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git lfs install | |
| # Create a non-root user and set up the app directory | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| WORKDIR /home/user/app | |
| # Install Python packages | |
| COPY --chown=1000:1000 requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of your application code (app.py, dh3.png, etc.) | |
| COPY --chown=1000:1000 . . | |
| # Set the command to run your app | |
| CMD ["python", "app.py"] |