FROM nvidia/cuda:12.5.1-cudnn-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV MPLCONFIGDIR=/tmp/matplotlib RUN apt-get update && apt-get install -y \ python3.11 \ python3.11-venv \ python3-pip \ git \ software-properties-common \ wget \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN add-apt-repository -y -r ppa:jonathonf/ffmpeg-4 \ && apt-get update \ && apt-get install -y ffmpeg \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 RUN pip3 install numpy matplotlib pillow gradio==3.38.0 opencv-python ffmpeg-python RUN git clone https://github.com/facebookresearch/segment-anything-2.git WORKDIR /app/segment-anything-2 RUN pip3 install -e . # RUN pip3 install -e ".[demo]" WORKDIR /app/segment-anything-2/checkpoints RUN ./download_ckpts.sh WORKDIR /app EXPOSE 7860 ENV GRADIO_SERVER_NAME="0.0.0.0" COPY app.py /app/app.py COPY assets /app/assets CMD ["python3", "-u", "app.py"]