Skip to content

Commit

Permalink
feat: Add Jetson humble docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
hmiranda-queiros committed Dec 9, 2023
1 parent d0afded commit e4f4aa4
Show file tree
Hide file tree
Showing 14 changed files with 4,218 additions and 37 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/docker_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ jobs:
platform: linux/amd64, linux/arm64
- dockerfile: ./docker_foxy_jetson/Dockerfile
context: ./docker_foxy_jetson
target: xplore_common
target: gazebo_nvidia
tag: foxy-jetson
platform: linux/arm64
- dockerfile: ./docker_humble_jetson/Dockerfile
context: ./docker_humble_jetson
target: gazebo_nvidia
tag: humble-jetson
platform: linux/arm64

permissions:
contents: read
Expand Down
74 changes: 40 additions & 34 deletions docker_foxy_jetson/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,41 +83,10 @@ RUN rm -rf /var/lib/apt/lists/*

ENV AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM dev AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

# Clean up
RUN rm -rf /var/lib/apt/lists/*

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1

###########################################
# Xplore Common image
###########################################
FROM gazebo_nvidia AS xplore_common
FROM dev AS xplore_common

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -147,13 +116,50 @@ RUN apt-get update && apt-get upgrade -y
RUN apt-get purge -y '*opencv*'
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-behaviortree-cpp-v3 \
ros-${ROS_DISTRO}-gazebo-ros-pkgs \
ros-${ROS_DISTRO}-xacro

WORKDIR /home/$USERNAME

# Allow non-root user to access the serial ports
RUN usermod -aG dialout $USERNAME
# Allow non-root user to access the video devices
RUN usermod -aG video $USERNAME

# Clean up
RUN rm -rf /var/lib/apt/lists/*
RUN rm -rf /var/lib/apt/lists/*

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM xplore_common AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

# Install Gazebo ROS packages
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-gazebo-ros-pkgs

# Clean up
RUN rm -rf /var/lib/apt/lists/*

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1
2 changes: 1 addition & 1 deletion docker_foxy_jetson/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-jetson --target xplore_common .
docker build --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-jetson --target gazebo_nvidia .
2 changes: 1 addition & 1 deletion docker_foxy_jetson/fresh_build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-jetson --target xplore_common .
docker build --pull --no-cache --progress=plain -t ghcr.io/epflxplore/docker_commons:foxy-jetson --target gazebo_nvidia .
165 changes: 165 additions & 0 deletions docker_humble_jetson/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
###########################################
# Base image
###########################################
FROM dustynv/ros:humble-desktop-l4t-r35.4.1 AS base

ARG DEBIAN_FRONTEND=noninteractive

# Install language
RUN apt-get update && apt-get install -y locales \
&& locale-gen en_US en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8

# Install timezone
ENV TZ=Europe/Zurich
RUN apt-get update && apt-get install -y tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
&& dpkg-reconfigure tzdata

# Install common programs
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
gnupg2 \
lsb-release \
sudo \
software-properties-common \
wget

# Clean up
RUN rm -rf /var/lib/apt/lists/*

ENV ROS_DISTRO=humble
ENV AMENT_PREFIX_PATH=/opt/ros/${ROS_DISTRO}
ENV COLCON_PREFIX_PATH=/opt/ros/${ROS_DISTRO}
ENV LD_LIBRARY_PATH=/opt/ros/${ROS_DISTRO}/lib
ENV PATH=/opt/ros/${ROS_DISTRO}/bin:$PATH
ENV PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python3.10/site-packages
ENV ROS_PYTHON_VERSION=3
ENV ROS_VERSION=2

###########################################
# Develop image
###########################################
FROM base AS dev

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
bash-completion \
build-essential \
cmake \
gdb \
git \
openssh-client \
python3-argcomplete \
python3-pip \
ros-dev-tools \
vim

RUN rosdep init || echo "rosdep already initialized"

ENV USERNAME=xplore
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create a non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# Add sudo support for the non-root user
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Set up autocompletion for user
RUN apt-get update && apt-get install -y git-core bash-completion \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/${USERNAME}/.bashrc \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then export _colcon_cd_root=/opt/ros/${ROS_DISTRO}/; fi" >> /home/${USERNAME}/.bashrc \
&& echo "if [ -f /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash ]; then source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash; fi" >> /home/${USERNAME}/.bashrc

# Clean up
RUN rm -rf /var/lib/apt/lists/*

ENV AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1

###########################################
# Xplore Common image
###########################################
FROM dev AS xplore_common

ARG DEBIAN_FRONTEND=noninteractive

# Install EposCmd library
WORKDIR /usr/local/lib
COPY ./EposCmd/lib/libEposCmd.so.6.7.1.0 .
COPY ./EposCmd/lib/libftd2xx.so.1.4.27 .
RUN ln -s libEposCmd.so.6.7.1.0 libEposCmd.so
RUN ln -s libftd2xx.so.1.4.27 libftd2xx.so

WORKDIR /usr/lib
RUN ln -s /usr/local/lib/libEposCmd.so libEposCmd.so
RUN ln -s /usr/local/lib/libftd2xx.so libftd2xx.so

WORKDIR /usr/include
COPY ./EposCmd/include/Definitions.h .
COPY ./EposCmd/include/ftd2xx.h .
RUN mv Definitions.h EposCmd.h

WORKDIR /etc/udev/rules.d
COPY ./EposCmd/misc/99-ftdi.rules .
COPY ./EposCmd/misc/99-epos4.rules .
RUN /etc/init.d/udev restart

# Install common ROS 2 packages
RUN apt-get update && apt-get upgrade -y
# RUN apt-get purge -y '*opencv*'
# RUN apt-get install -y --no-install-recommends \
# ros-${ROS_DISTRO}-behaviortree-cpp-v3 \
# ros-${ROS_DISTRO}-xacro

WORKDIR /home/$USERNAME

# Allow non-root user to access the serial ports
RUN usermod -aG dialout $USERNAME
# Allow non-root user to access the video devices
RUN usermod -aG video $USERNAME

# Clean up
RUN rm -rf /var/lib/apt/lists/*

###########################################
# Dev+Gazebo+Nvidia image
###########################################
FROM xplore_common AS gazebo_nvidia

ARG DEBIAN_FRONTEND=noninteractive

################
# Expose the nvidia driver to allow opengl
# Dependencies for glvnd and X11.
################
RUN apt-get update \
&& apt-get install -y -qq --no-install-recommends \
libglvnd0 \
libgl1 \
libglx0 \
libegl1 \
libxext6 \
libx11-6

# Install Gazebo
RUN curl -sSL http://get.gazebosim.org | sh

# Install Gazebo ROS packages
# RUN apt-get update && apt-get upgrade -y
# RUN apt-get install -y --no-install-recommends \
# ros-${ROS_DISTRO}-gazebo-ros-pkgs

# Clean up
RUN rm -rf /var/lib/apt/lists/*

# Env vars for the nvidia-container-runtime.
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute
ENV QT_X11_NO_MITSHM 1
Loading

0 comments on commit e4f4aa4

Please sign in to comment.