Dockerfile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 创建一个基础镜像
  2. FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04
  3. RUN apt-key del 7fa2af80
  4. RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
  5. RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
  6. # 重置apt-get
  7. RUN rm -rf /etc/apt/sources.list
  8. RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list
  9. RUN apt-get update
  10. RUN apt-get install -y default-jre
  11. RUN apt-get install -y cmake
  12. # 安装conda
  13. # yhyu13 : install additional packages
  14. # 设置apt的源为tsinghua镜像源
  15. RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
  16. RUN apt-get update && apt-get install -y curl wget
  17. # 安装conda
  18. RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
  19. && bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \
  20. && rm Miniconda3-latest-Linux-x86_64.sh
  21. RUN /opt/conda/bin/conda init bash
  22. RUN mkdir env
  23. # 解压env中的mxnet tensorflow lemon
  24. COPY env/mxnet.tar.gz env/mxnet.tar.gz
  25. RUN mkdir /opt/conda/envs/mxnet
  26. RUN tar -zxvf env/mxnet.tar.gz -C /opt/conda/envs/mxnet
  27. COPY env/tensorflow.tar.gz env/tensorflow.tar.gz
  28. RUN mkdir /opt/conda/envs/tensorflow
  29. RUN tar -zxvf env/tensorflow.tar.gz -C /opt/conda/envs/tensorflow
  30. COPY env/lemon.tar.gz env/lemon.tar.gz
  31. RUN mkdir /opt/conda/envs/lemon
  32. RUN tar -zxvf env/lemon.tar.gz -C /opt/conda/envs/lemon
  33. RUN rm -rf env
  34. # 复制项目文件
  35. WORKDIR /app
  36. COPY LEMON-master /app/LEMON-master
  37. RUN echo "conda activate lemon" >> ~/.bashrc
  38. # RUN conda install -n lemon cudatoolkit=10.1
  39. # 随便启动一个进程空转
  40. CMD ["/bin/bash"]
  41. # CMD ["tail", "-f", "/dev/null"]