橦言无忌

一个不想改变世界的程序媛

tensorrt parser的构建dockerfile

前言

trtparser的自构建镜像,是基于官方的trtparser,自己添加了一些常用软件,特点如下:

  • ubuntu换源;
  • 构建pth->onnx->trt转模型需要的环境;
  • python3的常用包;

有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
45
46
47
FROM nvcr.io/nvidia/tensorrt:20.02-py3

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 \
&& apt-get -y install openssh-client

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 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 grpcio-1.27.2-cp36-cp36m-manylinux2010_x86_64.whl \
&& pip3 install tensorboard-1.15.0-py3-none-any.whl \
&& pip3 install onnx-1.6.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 \
# RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip \
# && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==1.3.0 torchvision==0.4.1 \
# && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple onnx==1.6.0 onnxruntime==1.1.0 onnx-simplifier==0.2.2 \
# && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv_python==4.2.0 Pillow==6.0.0 \
# && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow_gpu==1.15.0 \
&& 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

WORKDIR /workspace
RUN rm -rf /softs

# RUN apt-get -y install isort clang-format nfs-common
ENTRYPOINT /bin/bash
// 代码折叠