From a45e032b237cf0f9ed86f6fff9956299ba1e1bcb Mon Sep 17 00:00:00 2001 From: Kalana Ratnayake Date: Sun, 4 Aug 2024 01:56:01 +1000 Subject: [PATCH] final steps of the ros image build --- README.md | 46 +++++++---------------- base-images/r3721.md | 34 +++++++++++++++++ ros-images/r3271.humble_base.Dockerfile | 50 ++++++++++++------------- ros-images/r3271.humble_core.Dockerfile | 50 ++++++++++++------------- 4 files changed, 97 insertions(+), 83 deletions(-) create mode 100644 base-images/r3721.md diff --git a/README.md b/README.md index b53a268..fbb079b 100644 --- a/README.md +++ b/README.md @@ -16,43 +16,25 @@ docker buildx create --use --driver-opt network=host --name MultiPlatform --plat ## Docker container list -
-

foxy-base

- -This image is an modified [nvcr.io/nvidia/l4t-base:r32.7.1](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags). The image has been modified by upgrading core Ubuntu 18.04 to Ubuntu 20.04. - -[dusty-nv/jetson-containers](https://github.com/dusty-nv/jetson-containers) allows building image for Jetson nano but they are based on offical [nvcr.io/nvidia/l4t-base:r32.7.1](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags) which is based on Ubuntu 18.04 and is limited by Python 3.6.9. +### 1. Jetson-base -Due to this, being inspired from [Qengineering/Jetson-Nano-Ubuntu-20-image](https://github.com/Qengineering/Jetson-Nano-Ubuntu-20-image) and based on [gpshead/Dockerfile](https://gist.github.com/gpshead/0c3a9e0a7b3e180d108b6f4aef59bc19), this image provides an Ubuntu 20.04 version of [nvcr.io/nvidia/l4t-base:r32.7.1](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags) +#### jetson-base:r32.7.1 -> Ubuntu 22.04 was also attempted, but later abandoned due to lack of support for gcc-8, g++8 and clang-8 required by CUDA 10.2 in r32.7.1 - -### Pull or Build -Pull the docker container -```bash -docker pull ghcr.io/kalanaratnayake/foxy-base:r32.7.1 +```docker +FROM ghcr.io/kalanaratnayake/jetson-base:r32.7.1 ``` -or +[Installation and local build instructions for jetson-base:r32.7.1 ](base-images/r3721.md) -Build the docker container -```bash -docker buildx build --load --platform linux/arm64 -f base-images/foxy.Dockerfile -t foxy-base:r32.7.1 . -``` +### 2. Jetson-minimal -### Start +#### jetson-minimal:r32.7.1 -Start the docker container -```bash -docker run --rm -it --runtime nvidia --network host --gpus all -e DISPLAY ghcr.io/kalanaratnayake/foxy-base:r32.7.1 bash -``` -
-
- -
-

Jetson Ubuntu Foxy Minimal Image

+```docker +FROM ghcr.io/kalanaratnayake/jetson-minimal:r32.7.1 +``` - GCC-8, G++-8 for building CUDA 10.2 related applications - build-essential package (g++-9, gcc-9, make, dpkg-dev, libc6-dev) @@ -172,10 +154,10 @@ or build with cache locally and push when image compilation can be slow on githu ```bash docker buildx build --push \ --platform linux/arm64 \ - --cache-from=type=registry,ref=ghcr.io/kalanaratnayake/foxy-ros:humble-ros-base-buildcache \ - --cache-to=type=registry,ref=ghcr.io/kalanaratnayake/foxy-ros:humble-ros-base-buildcache,mode=max \ - -f ros-images/humble_base.Dockerfile \ - -t ghcr.io/kalanaratnayake/foxy-ros:humble-base-r32.7.1 . + --cache-from=type=registry,ref=ghcr.io/kalanaratnayake/jetson-ros:humble-ros-base-r32.7.1-buildcache \ + --cache-to=type=registry,ref=ghcr.io/kalanaratnayake/jetson-ros:humble-ros-base-r32.7.1-buildcache,mode=max \ + -f ros-images/r3271.humble_base.Dockerfile \ + -t ghcr.io/kalanaratnayake/jetson-ros:humble-base-r32.7.1 . ``` ### Start diff --git a/base-images/r3721.md b/base-images/r3721.md new file mode 100644 index 0000000..9cbd0cc --- /dev/null +++ b/base-images/r3721.md @@ -0,0 +1,34 @@ +## jetson-base:r32.7.1 + +This image is an modified [nvcr.io/nvidia/l4t-base:r32.7.1](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags). The image has been modified by upgrading core Ubuntu 18.04 to Ubuntu 20.04. + +[dusty-nv/jetson-containers](https://github.com/dusty-nv/jetson-containers) allows building image for Jetson nano but they are based on offical [nvcr.io/nvidia/l4t-base:r32.7.1](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags) which is based on Ubuntu 18.04 and is limited by Python 3.6.9. + +Due to this, being inspired from [Qengineering/Jetson-Nano-Ubuntu-20-image](https://github.com/Qengineering/Jetson-Nano-Ubuntu-20-image) and based on [gpshead/Dockerfile](https://gist.github.com/gpshead/0c3a9e0a7b3e180d108b6f4aef59bc19), this image provides an Ubuntu 20.04 version of [nvcr.io/nvidia/l4t-base:r32.7.1](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags) + +> Ubuntu 22.04 was also attempted, but later abandoned due to lack of support for gcc-8, g++8 and clang-8 required by CUDA 10.2 in r32.7.1 + +
+ +### Pull or Build + +Pull the docker container +```bash +docker pull ghcr.io/kalanaratnayake/jetson-base:r32.7.1 +``` + +or + +Build the docker container +```bash +docker buildx build --load --platform linux/arm64 -f base-images/r3271.Dockerfile -t jetson-base:r32.7.1 . +``` + +
+ +### Start + +Start the docker container +```bash +docker run --rm -it --runtime nvidia --network host --gpus all -e DISPLAY ghcr.io/kalanaratnayake/jetson-base:r32.7.1 bash +``` \ No newline at end of file diff --git a/ros-images/r3271.humble_base.Dockerfile b/ros-images/r3271.humble_base.Dockerfile index 428e233..9b27d21 100644 --- a/ros-images/r3271.humble_base.Dockerfile +++ b/ros-images/r3271.humble_base.Dockerfile @@ -105,20 +105,20 @@ RUN rosdep install -y \ --rosdistro ${ROS_DISTRO} \ --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers" -#------------------------------- -# RUN colcon build \ -# --merge-install \ -# --cmake-args -DCMAKE_BUILD_TYPE=Release -# WORKDIR / +RUN colcon build \ + --merge-install \ + --cmake-args -DCMAKE_BUILD_TYPE=Release + +WORKDIR / # # remove ros source and build files. -# RUN rm -rf ${ROS_ROOT}/src -# RUN rm -rf ${ROS_ROOT}/log -# RUN rm -rf ${ROS_ROOT}/build +RUN rm -rf ${ROS_ROOT}/src +RUN rm -rf ${ROS_ROOT}/log +RUN rm -rf ${ROS_ROOT}/build -# RUN apt-get clean +RUN apt-get clean ############################################################################################################################# ##### @@ -126,13 +126,13 @@ RUN rosdep install -y \ ##### ############################################################################################################################# -# RUN apt-get update -y +RUN apt-get update -y -# RUN apt-get autoremove -y +RUN apt-get autoremove -y -# RUN rm -rf /var/lib/apt/lists/* -# RUN rm -rf /tmp/* -# RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* +RUN rm -rf /tmp/* +RUN apt-get clean #--------------------------------------------------------------------------------------------------------------------------- #---- @@ -140,13 +140,13 @@ RUN rosdep install -y \ #---- #--------------------------------------------------------------------------------------------------------------------------- -# FROM scratch AS final +FROM scratch AS final -# COPY --from=base / / +COPY --from=base / / -# COPY ros-images/ros_entrypoint.sh /ros_entrypoint.sh +COPY ros-images/ros_entrypoint.sh /ros_entrypoint.sh -# RUN chmod +x /ros_entrypoint.sh +RUN chmod +x /ros_entrypoint.sh ############################################################################################################################# ##### @@ -155,16 +155,16 @@ RUN rosdep install -y \ ##### ############################################################################################################################# -# ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp +ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -# ENV OPENBLAS_CORETYPE=ARMV8 +ENV OPENBLAS_CORETYPE=ARMV8 -# ARG ROS_VERSION=humble +ARG ROS_VERSION=humble -# ENV ROS_DISTRO=${ROS_VERSION} +ENV ROS_DISTRO=${ROS_VERSION} -# ENV ROS_ROOT=/opt/ros/${ROS_DISTRO} +ENV ROS_ROOT=/opt/ros/${ROS_DISTRO} -# WORKDIR / +WORKDIR / -# ENTRYPOINT ["/ros_entrypoint.sh"] +ENTRYPOINT ["/ros_entrypoint.sh"] diff --git a/ros-images/r3271.humble_core.Dockerfile b/ros-images/r3271.humble_core.Dockerfile index 391060f..670fb2f 100644 --- a/ros-images/r3271.humble_core.Dockerfile +++ b/ros-images/r3271.humble_core.Dockerfile @@ -105,21 +105,19 @@ RUN rosdep install -y \ --rosdistro ${ROS_DISTRO} \ --skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers" -#------------------------------- +RUN colcon build \ + --merge-install \ + --cmake-args -DCMAKE_BUILD_TYPE=Release -# RUN colcon build \ -# --merge-install \ -# --cmake-args -DCMAKE_BUILD_TYPE=Release - -# WORKDIR / +WORKDIR / # remove ros source and build files. -# RUN rm -rf ${ROS_ROOT}/src -# RUN rm -rf ${ROS_ROOT}/log -# RUN rm -rf ${ROS_ROOT}/build +RUN rm -rf ${ROS_ROOT}/src +RUN rm -rf ${ROS_ROOT}/log +RUN rm -rf ${ROS_ROOT}/build -# RUN apt-get clean +RUN apt-get clean ############################################################################################################################# ##### @@ -127,13 +125,13 @@ RUN rosdep install -y \ ##### ############################################################################################################################# -# RUN apt-get update -y +RUN apt-get update -y -# RUN apt-get autoremove -y +RUN apt-get autoremove -y -# RUN rm -rf /var/lib/apt/lists/* -# RUN rm -rf /tmp/* -# RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* +RUN rm -rf /tmp/* +RUN apt-get clean #--------------------------------------------------------------------------------------------------------------------------- #---- @@ -141,13 +139,13 @@ RUN rosdep install -y \ #---- #--------------------------------------------------------------------------------------------------------------------------- -# FROM scratch AS final +FROM scratch AS final -# COPY --from=base / / +COPY --from=base / / -# COPY ros-images/ros_entrypoint.sh /ros_entrypoint.sh +COPY ros-images/ros_entrypoint.sh /ros_entrypoint.sh -# RUN chmod +x /ros_entrypoint.sh +RUN chmod +x /ros_entrypoint.sh ############################################################################################################################# ##### @@ -156,16 +154,16 @@ RUN rosdep install -y \ ##### ############################################################################################################################# -# ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp +ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -# ENV OPENBLAS_CORETYPE=ARMV8 +ENV OPENBLAS_CORETYPE=ARMV8 -# ARG ROS_VERSION=humble +ARG ROS_VERSION=humble -# ENV ROS_DISTRO=${ROS_VERSION} +ENV ROS_DISTRO=${ROS_VERSION} -# ENV ROS_ROOT=/opt/ros/${ROS_DISTRO} +ENV ROS_ROOT=/opt/ros/${ROS_DISTRO} -# WORKDIR / +WORKDIR / -# ENTRYPOINT ["/ros_entrypoint.sh"] +ENTRYPOINT ["/ros_entrypoint.sh"]