-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile.tensorrt_source
54 lines (42 loc) · 1.65 KB
/
Dockerfile.tensorrt_source
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
48
49
50
51
52
53
54
FROM timongentzsch/l4t-ubuntu20-opencv-source
ENV DEBIAN_FRONTEND=noninteractive
ENV TENSORRT_VERSION=8.2.1
ENV TARGET_ARCHITECTURE=aarch64
ENV PYTHON_MAJOR_VERSION=3
ENV PYTHON_MINOR_VERSION=8
ENV CUDA_ROOT=/usr/local/cuda-10.2
ENV ROOT_PATH=/workspace/TensorRT
ENV EXT_PATH=/tmp
ENV PYTHON_SOURCE_TARBALL_VERSION=3.8.10
ENV PYTHON_SOURCE_TARBALL_URL=https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz
ENV PYBIND_RELEASE=v2.7.0
### TODO: Add multistagebuild with crosscompile image ###
RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-dev cmake build-essential git && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
#
# preparation
#
WORKDIR $EXT_PATH
RUN git clone https://github.com/pybind/pybind11.git -b ${PYBIND_RELEASE} && \
mkdir -p python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/include && \
wget ${PYTHON_SOURCE_TARBALL_URL} && \
tar -xzf *.tgz && \
rm -rf *.tgz && \
mv Python-${PYTHON_SOURCE_TARBALL_VERSION}/Include/* python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/include && \
rm -rf Python-${PYTHON_SOURCE_TARBALL_VERSION} && \
cp /usr/include/aarch64-linux-gnu/python3.8/pyconfig.h python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/include
SHELL ["/bin/bash", "-c", "-l"]
#
# TensortRT
#
WORKDIR /workspace
RUN git clone --recursive https://github.com/NVIDIA/TensorRT.git -b $TENSORRT_VERSION
RUN cd TensorRT/python && \
PYTHON_MAJOR_VERSION=$PYTHON_MAJOR_VERSION PYTHON_MINOR_VERSION=$PYTHON_MINOR_VERSION TARGET=$TARGET_ARCHITECTURE ./build.sh
#
# TEST
#
RUN python3 -m pip install ${ROOT_PATH}/python/build/dist/tensorrt-*.whl
CMD ["bash"]
WORKDIR /root