FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ PORT=8000 \ HF_HUB_DISABLE_PROGRESS_BARS=0 WORKDIR /app RUN apt-get update \ && apt-get install -y --no-install-recommends \ git libglib2.0-0 libsm6 libxrender1 libxext6 libx11-6 libxcb1 libgl1 libgl1-mesa-dri \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt ./ RUN python -m pip install --upgrade pip \ && python -m pip install -r requirements.txt COPY . ./ RUN chmod +x entrypoint.sh # /app/models is mounted as a volume so the SAM2 checkpoint persists across restarts VOLUME ["/app/models"] EXPOSE 8000 ENTRYPOINT ["./entrypoint.sh"]