Created
January 20, 2022 21:16
-
-
Save jadonk/bc3524d25621b777de3f830bc1f06b34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com/ | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions | |
# are met: | |
# | |
# Redistributions of source code must retain the above copyright | |
# notice, this list of conditions and the following disclaimer. | |
# | |
# Redistributions in binary form must reproduce the above copyright | |
# notice, this list of conditions and the following disclaimer in the | |
# documentation and/or other materials provided with the | |
# distribution. | |
# | |
# Neither the name of Texas Instruments Incorporated nor the names of | |
# its contributors may be used to endorse or promote products derived | |
# from this software without specific prior written permission. | |
# | |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
ARG USE_PROXY | |
ARG HTTP_PROXY | |
ARG REPO_LOCATION=arm64v8 | |
ARG DEBIAN_FRONTEND=noninteractive | |
#========================================================================= | |
# The environment variable REPO_LOCATION is set from outside as needed, | |
# based on network | |
FROM ${REPO_LOCATION}/ubuntu:20.04 AS base-0 | |
#========================================================================= | |
FROM base-0 AS base-1 | |
ARG USE_PROXY | |
ENV USE_PROXY=${USE_PROXY} | |
ARG HTTP_PROXY | |
ENV http_proxy=${HTTP_PROXY} | |
ENV https_proxy=${HTTP_PROXY} | |
#========================================================================= | |
#FROM base-${USE_PROXY} AS ubuntu-stage1 | |
FROM base-0 AS ubuntu-stage1 | |
ARG DEBIAN_FRONTEND | |
# setup proxy settings | |
#ADD setup_proxy.sh /root/ | |
#ADD proxy /root/proxy | |
#RUN /root/setup_proxy.sh | |
# install gstreamer dependencies | |
RUN apt update && apt install -y --no-install-recommends \ | |
libgstreamer1.0-0 \ | |
libgstreamer1.0-dev \ | |
libgstreamer-plugins-base1.0-dev \ | |
libgstreamer-plugins-good1.0-dev \ | |
gstreamer1.0-plugins-base \ | |
gstreamer1.0-plugins-good \ | |
gstreamer1.0-plugins-bad \ | |
gstreamer1.0-libav \ | |
gstreamer1.0-tools \ | |
gir1.2-gst-rtsp-server-1.0 \ | |
ninja-build && \ | |
rm -rf /var/lib/apt/lists/* | |
# install python packages | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
python3-pip && \ | |
python3 -m pip install --upgrade pip && \ | |
python3 -m pip install \ | |
meson \ | |
configparser \ | |
argparse && \ | |
rm -rf /var/lib/apt/lists/* | |
#========================================================================= | |
FROM ubuntu-stage1 AS ubuntu-ros2 | |
ARG DEBIAN_FRONTEND | |
# install ROS Foxy | |
# setup timezone | |
RUN echo 'Etc/UTC' > /etc/timezone && \ | |
ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ | |
apt-get update && \ | |
apt-get install -q -y --no-install-recommends tzdata && \ | |
rm -rf /var/lib/apt/lists/* | |
# install packages | |
RUN apt-get update && apt-get install -q -y --no-install-recommends \ | |
dirmngr \ | |
gnupg2 \ | |
curl \ | |
&& rm -rf /var/lib/apt/lists/* | |
# setup sources.list | |
RUN echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources.list.d/ros2-latest.list | |
# setup keys | |
# RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 | |
# workaround in case apt-key above does not work, e.g., behind a proxy | |
RUN curl -sSL 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xC1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' | apt-key add - | |
# setup environment variables | |
ENV LANG=C.UTF-8 | |
ENV LC_ALL=C.UTF-8 | |
ENV ROS_DISTRO=foxy | |
# install bootstrap tools | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
git \ | |
python3-colcon-common-extensions \ | |
python3-colcon-mixin \ | |
python3-rosdep \ | |
python3-vcstool \ | |
&& rm -rf /var/lib/apt/lists/* | |
# bootstrap rosdep | |
RUN rosdep init && \ | |
rosdep update --rosdistro ${ROS_DISTRO} | |
# setup colcon mixin and metadata | |
RUN colcon mixin add default \ | |
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ | |
colcon mixin update && \ | |
colcon metadata add default \ | |
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ | |
colcon metadata update | |
# install ros-core packages | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ros-foxy-ros-base=0.9.2-1* \ | |
&& rm -rf /var/lib/apt/lists/* | |
#========================================================================= | |
FROM ubuntu-ros2 | |
ARG DEBIAN_FRONTEND | |
# install dependency for tivision_apps.so | |
# TODO: check if these are still required in 20.04 | |
RUN apt-get update && apt-get install -y \ | |
libdevil-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev && \ | |
rm -rf /var/lib/apt/lists/* | |
# intsall utils and miscellaneous packages | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
wget \ | |
vim \ | |
tmux \ | |
gdb \ | |
iputils-ping \ | |
usbutils \ | |
ncurses-dev \ | |
libyaml-cpp-dev \ | |
rsync \ | |
strace \ | |
sysstat \ | |
gdb \ | |
net-tools \ | |
dialog \ | |
chrony \ | |
nfs-common \ | |
corkscrew \ | |
v4l-utils && \ | |
rm -rf /var/lib/apt/lists/* | |
# install additional ROS packages beyond ros-foxy-ros-base | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ros-foxy-rmw-cyclonedds-cpp \ | |
ros-foxy-cv-bridge \ | |
ros-foxy-image-transport \ | |
ros-foxy-camera-info-manager \ | |
libeigen3-dev \ | |
python3-opencv && \ | |
python3 -m pip install rosbags && \ | |
rm -rf /var/lib/apt/lists/* | |
# install vision_apps lib and DL runtime libs | |
ARG TIVA_LIB_VER=8.1.0 | |
#COPY lib/* /usr/lib/ | |
#COPY include/processor_sdk /usr/include/processor_sdk | |
#COPY include/dlr.h /usr/include/ | |
#RUN ln -s /usr/lib/libtivision_apps.so.$TIVA_LIB_VER /usr/lib/libtivision_apps.so && \ | |
# ln -s /usr/lib/libvx_tidl_rt.so.1.0 /usr/lib/libvx_tidl_rt.so && \ | |
# ln -s /usr/lib/libti_rpmsg_char.so.0.3.1 /usr/lib/libti_rpmsg_char.so.0 && \ | |
# ln -s /usr/lib/libti_rpmsg_char.so.0 /usr/lib/libti_rpmsg_char.so && \ | |
# ln -s /usr/lib/libonnxruntime.so.1.7.0 /usr/lib/libonnxruntime.so && \ | |
# ln -s /usr/lib/libtidl_onnxrt_EP.so.1.0 /usr/lib/libtidl_onnxrt_EP.so | |
WORKDIR /opt | |
RUN wget https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/08_01_00_11/exports/ti-processor-sdk-rtos-j721e-evm-08_01_00_11-prebuilt.tar.gz && \ | |
tar --skip-old-files --strip-components=2 -C / -xvzf ti-processor-sdk-rtos-j721e-evm-08_01_00_11-prebuilt.tar.gz ti-processor-sdk-rtos-j721e-evm-08_01_00_11-prebuilt/rootfs | |
# Not sure if `cp_others.sh` is required | |
#WORKDIR /root/src | |
#RUN git clone --single-branch --depth 1 --branch master https://github.com/beagleboard/processor_sdk_tidl_j7 && cd processor_sdk_tidl_j7 && ./cp_others.sh && ln -s /root/src/processor_sdk_tidl_j7 /usr/include/processor_sdk | |
WORKDIR /root/src | |
RUN git clone --single-branch --depth 1 --branch 1.0.1-ti_nv12 https://github.com/jadonk/gscam | |
WORKDIR /root/j7ros_home | |
RUN wget https://software-dl.ti.com/jacinto7/esd/robotics-sdk/data/tidl-semseg-model_8.1.0.5.tar.gz && tar xzf tidl-semseg-model_8.1.0.5.tar.gz && rm tidl-semseg-model_8.1.0.5.tar.gz | |
RUN cd tidl_semseg_model/tvmdlr_deeplabv3lite_mobilenetv2_tv_768x432_qat-p2_onnx/artifacts && ln -snf deploy_lib.so.j7 deploy_lib.so && ln -snf deploy_params.params.j7 deploy_params.params && ln -snf deploy_graph.json.j7 deploy_graph.json && cd /root/j7ros_home | |
RUN wget https://software-dl.ti.com/jacinto7/esd/robotics-sdk/data/ros-bag_2020_1109.tar.gz && tar xzf ros-bag_2020_1109.tar.gz && rm ros-bag_2020_1109.tar.gz | |
RUN wget https://software-dl.ti.com/jacinto7/esd/robotics-sdk/data/visual-localization_8.1.0.5.tar.gz && tar xzf visual-localization_8.1.0.5.tar.gz && rm visual-localization_8.1.0.5.tar.gz | |
RUN wget https://software-dl.ti.com/jacinto7/esd/robotics-sdk/data/lidar2d_2021_0521.tar.gz && tar xzf lidar2d_2021_0521.tar.gz && rm lidar2d_2021_0521.tar.gz | |
WORKDIR /opt | |
RUN git clone --single-branch --branch tidl-j7 --depth 1 https://github.com/TexasInstruments/tensorflow.git && \ | |
mkdir -p tensorflow/lite/tools/make/downloads && \ | |
cd tensorflow/lite/tools/make/downloads && \ | |
wget https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz && \ | |
tar xzf v1.12.0.tar.gz && \ | |
mv flatbuffers-1.12.0 flatbuffers && \ | |
rm -rf v1.12.0.tar.gz | |
WORKDIR /opt | |
RUN git clone --single-branch --depth 1 -b master https://github.com/dmlc/dlpack.git && cd dlpack && git checkout -b tidl_branch 3ec0443 | |
WORKDIR /opt | |
RUN git clone --single-branch --branch tidl-j7 --depth 1 https://github.com/TexasInstruments/onnxruntime.git | |
WORKDIR /opt/model_zoo | |
RUN wget https://git.ti.com/cgit/edgeai/edge_ai_apps/plain/download_models.sh && chmod +x download_models.sh | |
RUN ./download_models.sh --download ONR-OD-8050-ssd-lite-regNetX-800mf-fpn-bgr-coco-512x512 | |
RUN ./download_models.sh --download TFL-OD-2020-ssdLite-mobDet-DSP-coco-320x320 | |
WORKDIR /root/src | |
RUN git clone --single-branch --branch master https://github.com/beagleboard/processor_sdk_tidl_j7 && \ | |
cd processor_sdk_tidl_j7 && \ | |
./cp_others.sh # && \ | |
#cd .. && \ | |
#rm -rf /root/src/processor_sdk_tidl_j7 | |
WORKDIR /opt | |
RUN wget https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/08_01_00_11/exports/ti-processor-sdk-rtos-j721e-evm-08_01_00_11.tar.gz && \ | |
tar xzf ti-processor-sdk-rtos-j721e-evm-08_01_00_11.tar.gz && \ | |
cd ti-processor-sdk-rtos-j721e-evm-08_01_00_11 && \ | |
echo "BUILD_EMULATION=no" >> tiovx/build_flags.mak && \ | |
echo "BUILD_TARGET_MODE=yes" >> tiovx/build_flags.mak && \ | |
echo "BUILD_LINUX_A72=yes" >> tiovx/build_flags.mak && \ | |
echo "PROFILE=release" >> tiovx/build_flags.mak && \ | |
cd vision_apps && \ | |
make vision_apps -j2 | |
#tar xzf ti-processor-sdk-rtos-j721e-evm-08_01_00_11.tar.gz ti-processor-sdk-rtos-j721e-evm-08_01_00_11/imaging && \ | |
#cd ti-processor-sdk-rtos-j721e-evm-08_01_00_11/imaging/ti_2a_wrapper/src && \ | |
#cp prebuilt_libs/J7/A72/LINUX/release/* /usr/local/lib/ && \ | |
#gcc -fPIC -rdynamic -shared ti_2a_wrapper/src/ti_2a_wrapper.c -o libtiimaging.so -I../include -I/usr/include -I/usr/include/processor_sdk/tiovx/include -I/usr/include/processor_sdk/tiovx/kernels/include -I/usr/include/processor_sdk/tiovx/kernels_j7/include -I../../kernels/include -I../../algos/dcc/include -I../../algos/awb/include -I../../algos/ae/include -I../../sensor_drv/include -I../../kernels/arm -I../../itt_server_remote/include -I/root/src/processor_sdk_tidl_j7/vision_apps/utils/remote_service/include -I/usr/include/processor_sdk/vision_apps/utils/ipc/include -DSOC_J721E && \ | |
#cp libtiimaging.so /usr/local/lib/libti_2a_wrapper.so | |
WORKDIR /root/src | |
RUN python3 -m pip install dlr && \ | |
ln -s /usr/lib/python3.8/site-packages/dlr/libdlr.so /usr/local/lib/libdlr.so | |
# install edgeai-tiovx-modules | |
WORKDIR /root/src | |
RUN git clone --single-branch --branch main https://github.com/TexasInstruments/edgeai-tiovx-modules.git && \ | |
cd edgeai-tiovx-modules && \ | |
mkdir build && \ | |
cd build && \ | |
cmake .. && \ | |
make -j1 && \ | |
make install && \ | |
rm -rf /root/src/edgeai-tiovx-modules | |
# install edgeai-gst-plugins | |
WORKDIR /root/src | |
RUN git clone --single-branch --branch fix/pkgconfig-imaging-sdk-update https://github.com/TexasInstruments/edgeai-gst-plugins.git && \ | |
cd edgeai-gst-plugins && \ | |
meson build --prefix=/usr -Dpkg_config_path=pkgconfig && \ | |
ninja -C build && \ | |
ninja -C build install && \ | |
ldconfig && \ | |
rm -rf /root/src/edgeai-gst-plugins | |
# add scripts | |
COPY entrypoint_arm64v8.sh /root/entrypoint.sh | |
ADD ros_setup.sh /root/ | |
# .profile and .bashrc | |
WORKDIR /root | |
RUN echo "if [ -n \"$BASH_VERSION\" ]; then" > .profile && \ | |
echo " # include .bashrc if it exists" >> .profile && \ | |
echo " if [ -f \"$HOME/.bashrc\" ]; then" >> .profile && \ | |
echo " . \"$HOME/.bashrc\"" >> .profile && \ | |
echo " fi" >> .profile && \ | |
echo "fi" >> .profile && \ | |
echo "#!/bin/bash" > .bashrc && \ | |
echo "export PS1=\"${debian_chroot:+($debian_chroot)}\u@j7-docker:\w\$ \"" >> .bashrc | |
# workdir for ROS apps | |
ARG PROJECT_HOME=j7ros_home | |
ENV WORK_DIR=/root/${PROJECT_HOME} | |
ENV ROS_WS=${WORK_DIR}/ros_ws | |
WORKDIR ${ROS_WS} | |
# change the DDS implementation to Cyclone DDS | |
ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp | |
# setup entrypoint | |
ENTRYPOINT ["/root/entrypoint.sh"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment