Files
DriveOS/Dockerfile
2024-03-05 18:27:01 +08:00

59 lines
2.2 KiB
Docker

FROM nvcr.io/drive/driveos-sdk/drive-agx-orin-linux-aarch64-sdk-build-x86:6.0.4.0-0004-patch-01
ENV TZ=Asia/Shanghai
ARG user=jiayu
#Force Nvidia GPU
ENV __NV_PRIME_RENDER_OFFLOAD=1
ENV __GLX_VENDOR_LIBRARY_NAME=nvidia
#Cuda TensorRT
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
ENV LD_LIBRARY_PATH="/usr/local/tensorrt/lib:${LD_LIBRARY_PATH}"
ENV CUDA_TOOLKIT_ROOT="/usr/local/cuda-11.4"
#TensorRT update
COPY ./trtdeb /home/trtdeb
RUN dpkg -i /home/trtdeb/x86/*.deb
RUN dpkg -i /home/trtdeb/aarch/*.deb
RUN rm -rf /home/trtdeb
#Protobuf
RUN apt update && apt install libprotobuf-dev -y
COPY ./protobuf_aarch/usr/lib/aarch64-linux-gnu/* /usr/lib/aarch64-linux-gnu/
#rootfs fix
RUN rm /drive/drive-linux/filesystem/targetfs/usr/lib/aarch64-linux-gnu/librt.so
RUN ln -s /usr/aarch64-linux-gnu/lib/librt.so /drive/drive-linux/filesystem/targetfs/usr/lib/aarch64-linux-gnu/librt.so
#ROS2
RUN apt update && apt install locales -y
RUN locale-gen en_US en_US.UTF-8
RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
RUN export LANG=en_US.UTF-8
RUN apt install software-properties-common -y
RUN add-apt-repository universe
RUN apt update && apt install curl gnupg2 lsb-release -y
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN export DEBIAN_FRONTEND=noninteractive && apt update && apt install ros-foxy-desktop -y
RUN source /opt/ros/foxy/setup.bash
RUN echo "source /opt/ros/foxy/setup.bash" >> ~/.bashrc
WORKDIR /opt/ros
RUN ln -sfn foxy ros2
# set userinfo
RUN useradd -rm -c ${user} -u 1000 -d /home/${user} -s /bin/bash -G sudo ${user}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN echo "$user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# set working directory of trt webinar
RUN mkdir -p /home/${user}/workspace/
RUN chown -R ${user}:users /home/${user}
COPY .bashrc /home/${user}/.bashrc
RUN echo "source /opt/ros/foxy/setup.bash" >> /home/${user}/.bashrc
WORKDIR /home/${user}
USER ${user}