frigate/docker/Dockerfile.wheels.l4t

37 lines
1.9 KiB
Docker
Raw Normal View History

2022-01-11 12:26:12 +03:00
FROM timongentzsch/l4t-ubuntu20-base:latest
ENV DEBIAN_FRONTEND=noninteractive
2022-03-17 17:08:15 +03:00
RUN apt-get update && apt-get install -yqq git python3.9 python3.9-dev python3-pip build-essential curl wget cmake
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
2022-01-11 12:26:12 +03:00
RUN \
EXT_PATH=~/external && \
mkdir -p $EXT_PATH && cd $EXT_PATH && \
git clone https://github.com/pybind/pybind11.git
RUN \
PYTHON_VERSION=`python -c 'import platform;print(platform.python_version())'` && \
EXT_PATH=~/external && \
mkdir Python-${PYTHON_VERSION} && wget -qO- https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz | tar xvz --strip-components=1 -C Python-${PYTHON_VERSION} && \
2022-03-17 17:08:15 +03:00
mkdir -p ${EXT_PATH}/python3.9/include && mv Python-${PYTHON_VERSION}/Include/* ${EXT_PATH}/python3.9/include/ && rm -rf Python-${PYTHON_VERSION} && \
cp /usr/include/aarch64-linux-gnu/python3.9/pyconfig.h ~/external/python3.9/include/
2022-01-11 12:26:12 +03:00
2022-03-17 17:08:15 +03:00
RUN \
2022-01-11 12:26:12 +03:00
mkdir /workspace && cd /workspace && git clone https://github.com/NVIDIA/TensorRT.git && \
mkdir -p /workspace/TensorRT/python/include/onnx
WORKDIR /workspace/TensorRT/python
# monkeypatch the environment
RUN \
cd /workspace/TensorRT/python && \
2022-03-17 17:08:15 +03:00
echo "update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1\n"\
"update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1\n"\
"mkdir -p /wheels && pip3 wheel --wheel-dir=/wheels pycuda==2021.1\n"\
2022-01-11 12:26:12 +03:00
"cp -r /usr/local/cuda-10.2/targets/aarch64-linux/include/* ./include/\n"\
"cp -r /usr/include/aarch64-linux-gnu/* ./include/onnx/\n"\
2022-03-17 17:08:15 +03:00
"EXT_PATH=/root/external PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=9 TARGET_ARCHITECTURE=aarch64 ./build.sh\n" \
2022-01-11 12:26:12 +03:00
"cp /workspace/TensorRT/python/build/dist/*.whl /wheels\n" >> ./bootstrap.sh && \
chmod +x ./bootstrap.sh
CMD ["/bin/bash", "./bootstrap.sh"]