前言
trtserver的docker镜像,官方的基础镜像,自己加了一些常用包,然后写了dockerfile来构建,基本内容如下:
- 基础镜像是:tensorrtserver:20.02-py3-clientsdk
- 包含ubuntu换源;
- pip3安装常用包,使用的是清华源;
- 提前下载了部分whl包到同dockerfile目录的
dockerfile加持后真的方便呀~
dockerfile源码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| FROM nvcr.io/nvidia/tensorrtserver:20.02-py3-clientsdk
LABEL maintainer="XINWEN" RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak RUN echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list \ && echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" >> /etc/apt/sources.list \ && apt-get update \ && apt-get -y install clang-format nfs-common
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py --force-reinstall
ADD ./soft/* /softs/ WORKDIR /softs RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip \ && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple bcolz \ # && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple onnx==1.5.0 \ && pip3 install torch-1.3.0-cp36-cp36m-manylinux1_x86_64.whl \ && pip3 install Pillow-6.0.0-cp36-cp36m-manylinux1_x86_64.whl \ && pip3 install h5py-2.10.0-cp36-cp36m-manylinux1_x86_64.whl \ && pip3 install opencv_python-4.2.0.32-cp36-cp36m-manylinux1_x86_64.whl \ && pip3 install tensorflow_gpu-1.15.0-cp36-cp36m-manylinux2010_x86_64.whl \ && pip3 install torchvision-0.4.1-cp36-cp36m-manylinux1_x86_64.whl \ # && pip3 install onnxruntime-1.1.0-cp36-cp36m-manylinux1_x86_64.whl \ # && cd onnx-simplifier-0.2.2 && python3 setup.py install \ && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pytest pyhamcrest pytest-cov black==19.3b0 isort==4.3.21 flake8 'pillow<7.0.0' cython dvc \ # && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple scipy \ # && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple sklearn \ # && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib \ && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy \ # && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pymongo && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pymysql
WORKDIR /workspace RUN rm -rf /softs
ENTRYPOINT /bin/bash
|