Skip to content

Instantly share code, notes, and snippets.

@GowriUmesh
Created May 11, 2022 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GowriUmesh/b89a47732efba58cdaeabc9d599cd311 to your computer and use it in GitHub Desktop.
Save GowriUmesh/b89a47732efba58cdaeabc9d599cd311 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
# This is a shell script that configures the build arguements to the Dockefile
# and builds a Docker image for Jetson with a default tag.
ZED_SDK_MAJOR=3 # ZED SDK major version
ZED_SDK_MINOR=7 # ZED SDK minor version
L4T_MINOR_VERSION=7 #L4T Minor version
ROS_DISTRO_ARG="melodic" # ROS DISTRO
# Default Tag based on the selected versions
TAG="${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-ros-tools-devel-l4t-r32.${L4T_MINOR_VERSION}"
echo "Building '${TAG}'"
docker build --build-arg 4T_MINOR_VERSION=${L4T_MINOR_VERSION} \
--build-arg ZED_SDK_MAJOR=${ZED_SDK_MAJOR} \
--build-arg ZED_SDK_MINOR=${ZED_SDK_MINOR} \
--build-arg ROS_DISTRO_ARG=${ROS_DISTRO_ARG} \
-t "${TAG}" -f Dockerilfe.rosjetson .
ARG ZED_SDK_MAJOR
ARG ZED_SDK_MINOR
ARG L4T_MINOR_VERSION
ARG ROS_DISTRO_ARG
# Specify the parent image from which we build
FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-devel-l4t-r32.${L4T_MINOR_VERSION}
# Setup ROS
RUN apt-get update -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata gnupg2 && \
sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \
apt-get update &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y ros-$ROS_DISTRO-$ROS_PKG build-essential cmake usbutils git -y --allow-unauthenticated && \
apt-get install -y python-rosdep python-rosinstall python-rosinstall-generator python-wstool &&\
rm -rf /var/lib/apt/lists/*
#Setup ROS workspace
RUN mkdir -p /opt/ros_ws/src
WORKDIR /opt/ros_ws
RUN . /opt/ros/noetic/setup.sh && \
catkin_make
# setup entrypoint
COPY ./ros_entrypoint.sh /
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
#!/bin/bash
set -e
# setup ros environment
source "/opt/ros/$ROS_DISTRO/setup.bash"
source "$ROS_WS/devel/setup.bash"
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment