mirror of
https://github.com/foomo/gsamservice.git
synced 2025-10-16 12:35:37 +00:00
57 lines
1.7 KiB
Docker
57 lines
1.7 KiB
Docker
FROM docker.io/pytorch/pytorch:2.3.1-cuda12.1-cudnn8-devel
|
|
|
|
# arguments to build Docker Image using CUDA
|
|
ARG USE_CUDA=0
|
|
ARG TORCH_ARCH="7.0;7.5;8.0;8.6"
|
|
|
|
ENV AM_I_DOCKER=True
|
|
ENV BUILD_WITH_CUDA="${USE_CUDA}"
|
|
ENV TORCH_CUDA_ARCH_LIST="${TORCH_ARCH}"
|
|
ENV CUDA_HOME=/usr/local/cuda-12.1/
|
|
# ensure CUDA is correctly set up
|
|
ENV PATH=/usr/local/cuda-12.1/bin:${PATH}
|
|
ENV LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64:${LD_LIBRARY_PATH}
|
|
|
|
# install required packages and specific gcc/g++
|
|
RUN apt-get update && apt-get install --no-install-recommends wget ffmpeg=7:* \
|
|
libsm6=2:* libxext6=2:* git=1:* nano vim=2:* ninja-build gcc-10 g++-10 git -y \
|
|
&& apt-get clean && apt-get autoremove && rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV CC=gcc-10
|
|
ENV CXX=g++-10
|
|
|
|
# clone grounded sam2 repo
|
|
WORKDIR /home/appuser
|
|
RUN git clone https://github.com/IDEA-Research/Grounded-SAM-2
|
|
|
|
# download sam2 checkpoints
|
|
WORKDIR /home/appuser/Grounded-SAM-2/checkpoints
|
|
RUN bash download_ckpts.sh
|
|
|
|
# download grounding dino checkpoints
|
|
WORKDIR /home/appuser/Grounded-SAM-2/gdino_checkpoints
|
|
RUN bash download_ckpts.sh
|
|
|
|
WORKDIR /home/appuser/Grounded-SAM-2
|
|
|
|
# install essential Python packages
|
|
RUN python -m pip install --upgrade pip "setuptools>=62.3.0,<75.9" wheel numpy \
|
|
opencv-python transformers supervision pycocotools addict yapf timm
|
|
|
|
# install segment_anything package in editable mode
|
|
RUN python -m pip install -e .
|
|
|
|
# install grounding dino
|
|
RUN python -m pip install --no-build-isolation -e grounding_dino
|
|
|
|
# install the server dependencies
|
|
COPY requirements.txt requirements.txt
|
|
RUN python -m pip install -r requirements.txt
|
|
|
|
COPY app.py app.py
|
|
COPY imagesegmentation.py imagesegmentation.py
|
|
|
|
# RUN mkdir ../host
|
|
|
|
# start the server
|
|
ENTRYPOINT ["python", "app.py", "--log-level", "debug"] |