You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Dockerfile.ubuntu 4.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ARG BASE_IMAGE=reg.docker.alibaba-inc.com/modelscope/ubuntu:20.04-cuda11.3.0-cudnn8-devel
  2. FROM $BASE_IMAGE
  3. ARG DEBIAN_FRONTEND=noninteractive
  4. ENV TZ=Asia/Shanghai
  5. ENV CONDA_DIR /opt/conda
  6. ENV PATH="${CONDA_DIR}/bin:${PATH}"
  7. ENV arch=x86_64
  8. SHELL ["/bin/bash", "-c"]
  9. COPY docker/rcfiles /tmp/resources
  10. RUN apt-get update && apt-get install -y --reinstall ca-certificates && \
  11. cp /tmp/resources/ubuntu20.04_sources.tuna /etc/apt/sources.list && \
  12. apt-get update && \
  13. apt-get install -y locales wget git vim ffmpeg libsm6 tzdata language-pack-zh-hans ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy libxext6 build-essential ninja-build && \
  14. wget https://packagecloud.io/github/git-lfs/packages/debian/bullseye/git-lfs_3.2.0_amd64.deb/download -O ./git-lfs_3.2.0_amd64.deb && \
  15. dpkg -i ./git-lfs_3.2.0_amd64.deb && \
  16. rm -f ./git-lfs_3.2.0_amd64.deb && \
  17. locale-gen zh_CN && \
  18. locale-gen zh_CN.utf8 && \
  19. update-locale LANG=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8 && \
  20. ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
  21. dpkg-reconfigure --frontend noninteractive tzdata && \
  22. apt-get clean && \
  23. rm -rf /var/lib/apt/lists/*
  24. ENV LANG=zh_CN.UTF-8 LANGUAGE=zh_CN.UTF-8 LC_ALL=zh_CN.UTF-8
  25. #install and config python
  26. ARG PYTHON_VERSION=3.7.13
  27. RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-${arch}.sh -O ./miniconda.sh && \
  28. /bin/bash miniconda.sh -b -p /opt/conda && \
  29. rm -f miniconda.sh && \
  30. ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
  31. echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
  32. cp /tmp/resources/conda.tuna ~/.condarc && \
  33. source /root/.bashrc && \
  34. conda install --yes python==${PYTHON_VERSION} && \
  35. pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
  36. ARG USE_GPU=True
  37. # install pytorch
  38. ARG TORCH_VERSION=1.12.0
  39. ARG CUDATOOLKIT_VERSION=11.3
  40. RUN if [ "$USE_GPU" = "True" ] ; then \
  41. conda install --yes pytorch==$TORCH_VERSION torchvision torchaudio cudatoolkit=$CUDATOOLKIT_VERSION -c pytorch && conda clean --yes --all; \
  42. else \
  43. conda install pytorch==$TORCH_VERSION torchvision torchaudio cpuonly -c pytorch; \
  44. fi
  45. # install tensorflow
  46. ARG TENSORFLOW_VERSION=1.15.5
  47. RUN if [ "$USE_GPU" = "True" ] ; then \
  48. pip install --no-cache-dir --use-deprecated=legacy-resolver tensorflow==$TENSORFLOW_VERSION -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html; \
  49. else \
  50. pip install --no-cache-dir tensorflow==$TENSORFLOW_VERSION; \
  51. fi
  52. RUN if [ "$USE_GPU" = "True" ] ; then \
  53. CUDA_HOME=/usr/local/cuda TORCH_CUDA_ARCH_LIST="5.0 5.2 6.0 6.1 7.0 7.5 8.0 8.6" MMCV_WITH_OPS=1 MAX_JOBS=8 FORCE_CUDA=1 pip install --no-cache-dir mmcv-full && pip cache purge; \
  54. else \
  55. MMCV_WITH_OPS=1 MAX_JOBS=8 pip install --no-cache-dir mmcv-full && pip cache purge; \
  56. fi
  57. # install modelscope
  58. COPY requirements /var/modelscope
  59. RUN pip install --no-cache-dir --upgrade pip && \
  60. pip install --no-cache-dir -r /var/modelscope/framework.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
  61. pip install --no-cache-dir -r /var/modelscope/audio.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
  62. pip install --no-cache-dir -r /var/modelscope/cv.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
  63. pip install --no-cache-dir -r /var/modelscope/multi-modal.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
  64. pip install --no-cache-dir -r /var/modelscope/nlp.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html && \
  65. pip cache purge
  66. # default shell bash
  67. ENV SHELL=/bin/bash
  68. # install special package
  69. RUN pip install --no-cache-dir mmcls>=0.21.0 mmdet>=2.25.0 decord>=0.6.0 numpy==1.18.5 datasets==2.1.0
  70. RUN if [ "$USE_GPU" = "True" ] ; then \
  71. pip install --no-cache-dir dgl-cu113 dglgo -f https://data.dgl.ai/wheels/repo.html; \
  72. else \
  73. pip install --no-cache-dir dgl dglgo -f https://data.dgl.ai/wheels/repo.html; \
  74. fi