diff --git a/Dockerfile b/Dockerfile index a4327e13738f36d81f4b98c0d00800c9b246310b..aa01174568c789ad307bf7f65e5757730bda9a8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,9 +2,7 @@ FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get -y update - -RUN apt-get install -y \ +RUN apt-get -y update && apt-get install -y \ build-essential \ cmake \ ninja-build \ @@ -24,10 +22,9 @@ RUN apt-get install -y \ libopenblas-base \ libsm6 \ libxext6 \ - libxrender-dev \ - glibc-source - -RUN apt-get autoremove -y && \ + libxrender-dev \ + glibc-source && \ + apt-get autoremove -y && \ apt-get autoclean -y && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* @@ -42,13 +39,26 @@ ENV PATH="$WRKSPCE/miniconda3/bin:${PATH}" RUN conda update -c defaults conda -RUN conda create -n segment_anything_env python=3.9 +# Create the environment and install all the requirements +RUN conda create -n segment_anything_env python=3.9 -y && \ + conda init bash && \ + echo "conda activate segment_anything_env" >> ~/.bashrc +# Make RUN commands use the new environment: SHELL ["conda", "run", "-n", "segment_anything_env", "/bin/bash", "-c"] -RUN git clone https://github.com/facebookresearch/segment-anything.git \ - && cd segment-anything && pip install -e . \ - && pip install opencv-python pycocotools matplotlib onnxruntime onnx +# Install the requirements +RUN pip install setuptools==60.9.3 && \ + git clone https://github.com/facebookresearch/segment-anything.git && \ + cd segment-anything && pip install -e . && \ + pip install opencv-python pycocotools matplotlib onnxruntime onnx + +# Uncomment the following line if you want to install PyTorch and related packages within the Conda environment +# RUN conda install pytorch torchvision torchaudio cudatoolkit=11.2 -c pytorch -c nvidia + +# Set the default command to bash to activate conda environment on run +CMD ["/bin/bash"] + # RUN conda install pytorch>=1.7 torchvision>=0.8 torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia #RUN pip3 install ffmpeg gnutls