Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile.jetson #24

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ros-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 30000
root-reserve-mb: 35000
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
Expand Down
53 changes: 18 additions & 35 deletions Dockerfile.jetson
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ ARG ZED_SDK_MAJOR=4
ARG ZED_SDK_MINOR=0
ARG ROS_DISTRO=foxy

### DOWNLOAD HUSARNET ###
FROM ubuntu:20.04 AS husarnet-dds-getter

ARG TARGETARCH
ARG HUSARNET_DDS_RELEASE="v1.3.5"

ENV HUSARNET_DDS_DEBUG=FALSE

RUN apt update && apt install -y \
curl

RUN curl -L https://github.com/husarnet/husarnet-dds/releases/download/${HUSARNET_DDS_RELEASE}/husarnet-dds-linux-${TARGETARCH} -o /usr/bin/husarnet-dds

### BUILD IMAGE ###
FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-devel-l4t-r${L4T_MAJOR}.${L4T_MINOR} AS build

Expand All @@ -45,22 +32,18 @@ RUN echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources
# ZED setup
RUN apt-get update || true && \
apt-get install --no-install-recommends -y \
ros-dev-tools \
ros-${ROS_DISTRO}-ros-base \
ros-${ROS_DISTRO}-ament-cmake-clang-format \
ros-${ROS_DISTRO}-image-transport \
ros-${ROS_DISTRO}-image-transport-plugins \
ros-${ROS_DISTRO}-diagnostic-updater \
ros-${ROS_DISTRO}-xacro \
build-essential \
git \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
python3-flake8-docstrings \
python3-pip \
python3-pytest-cov \
ros-dev-tools && \
python3-pytest-cov && \
pip3 install \
argcomplete \
numpy \
Expand Down Expand Up @@ -93,12 +76,13 @@ COPY ./healthcheck.cpp /ros2_ws/src/healthcheck_pkg/src/
# Build
WORKDIR /ros2_ws
RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli'
colcon build --parallel-workers $(nproc) \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' \
' --no-warn-unused-cli' && \
rm -rf build log

### RUNTIME IMAGE ### # Reduction from 6.1GB to 3.9GB
FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-runtime-l4t-r${L4T_MAJOR}.${L4T_MINOR} AS runtime
Expand All @@ -109,8 +93,6 @@ ARG ZED_SDK_MAJOR
ARG ZED_SDK_MINOR
ARG ROS_DISTRO

COPY --from=build /ros2_ws /ros2_ws

SHELL ["/bin/bash", "-c"]

ENV NVIDIA_DRIVER_CAPABILITIES \
Expand All @@ -128,6 +110,7 @@ RUN echo "deb http://packages.ros.org/ros2/ubuntu focal main" > /etc/apt/sources
# ZED setup
RUN apt-get update || true && \
apt-get install --no-install-recommends -y \
ros-dev-tools \
ros-${ROS_DISTRO}-ros-base \
ros-${ROS_DISTRO}-ament-cmake-clang-format \
ros-${ROS_DISTRO}-image-transport \
Expand All @@ -136,15 +119,11 @@ RUN apt-get update || true && \
ros-${ROS_DISTRO}-xacro \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
build-essential \
git \
python3-colcon-common-extensions \
curl \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
python3-flake8-docstrings \
python3-pip \
python3-pytest-cov \
ros-dev-tools && \
python3-pytest-cov && \
pip3 install \
argcomplete \
numpy \
Expand All @@ -153,6 +132,7 @@ RUN apt-get update || true && \
rm -rf /var/lib/apt/lists/*

# Check dependencies
COPY --from=build /ros2_ws /ros2_ws
WORKDIR /ros2_ws
RUN apt-get update && \
source /opt/ros/$ROS_DISTRO/setup.bash && \
Expand All @@ -173,8 +153,11 @@ COPY ./healthcheck.sh /
HEALTHCHECK --interval=2s --timeout=1s --start-period=20s --retries=1 \
CMD ["/healthcheck.sh"]

# Add Husarnet
COPY --from=husarnet-dds-getter /usr/bin/husarnet-dds /usr/bin/husarnet-dds
# Download Husarnet
ARG TARGETARCH
ARG HUSARNET_DDS_RELEASE="v1.3.5"
ENV HUSARNET_DDS_DEBUG=FALSE
RUN curl -L https://github.com/husarnet/husarnet-dds/releases/download/${HUSARNET_DDS_RELEASE}/husarnet-dds-linux-${TARGETARCH} -o /usr/bin/husarnet-dds
RUN chmod +x /usr/bin/husarnet-dds

# Setup environment variables
Expand Down
Loading