# 创建一个基础镜像 FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 RUN apt-key del 7fa2af80 RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub # 重置apt-get RUN rm -rf /etc/apt/sources.list RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list RUN apt-get update RUN apt-get install -y default-jre RUN apt-get install -y cmake # 安装conda # yhyu13 : install additional packages # 设置apt的源为tsinghua镜像源 RUN sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list RUN apt-get update && apt-get install -y curl wget # 安装conda RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ && bash Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda \ && rm Miniconda3-latest-Linux-x86_64.sh RUN /opt/conda/bin/conda init bash RUN mkdir env # 解压env中的mxnet tensorflow lemon COPY env/mxnet.tar.gz env/mxnet.tar.gz RUN mkdir /opt/conda/envs/mxnet RUN tar -zxvf env/mxnet.tar.gz -C /opt/conda/envs/mxnet COPY env/tensorflow.tar.gz env/tensorflow.tar.gz RUN mkdir /opt/conda/envs/tensorflow RUN tar -zxvf env/tensorflow.tar.gz -C /opt/conda/envs/tensorflow COPY env/lemon.tar.gz env/lemon.tar.gz RUN mkdir /opt/conda/envs/lemon RUN tar -zxvf env/lemon.tar.gz -C /opt/conda/envs/lemon RUN rm -rf env # 复制项目文件 # COPY lemon_master /app/lemon_master COPY app.py /app/app.py COPY tool.py /app/tool.py # COPY config.yml /app/config.yml COPY cifar-10-batches-py.tar.gz /root/.keras/datasets/cifar-10-batches-py.tar.gz COPY mnist.npz /root/.keras/datasets/mnist.npz RUN echo "conda activate lemon" >> ~/.bashrc ENV TZ=Asia/Shanghai RUN echo "${TZ}" > /etc/timezone \ && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ && apt update \ && apt install -y tzdata \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # 随便启动一个进程空转 ENTRYPOINT ["/bin/bash", "-c", "source ~/.bashrc && /opt/conda/envs/lemon/bin/python app.py"] # CMD ["/bin/bash"] # CMD ["tail", "-f", "/dev/null"]