Skip to content

Commit 4a84d7b

Browse files
Use ros2-apt-source for debian (#350)
1 parent c0e1a8a commit 4a84d7b

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

ros2_debian/Dockerfile.debian11

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ RUN apt-get update -y -qq && \
6060
tar \
6161
unzip \
6262
wget \
63-
&& \
63+
&&\
6464
: "remove cache" && \
6565
rm -rf /var/lib/apt/lists/*
6666

67-
# add the ROS 2 GPG key with apt and setup sources.list
68-
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
69-
sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' && \
70-
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
67+
# Setup keys
68+
RUN set -eux; \
69+
export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') \
70+
&& curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb" \
71+
&& apt install /tmp/ros2-apt-source.deb
7172

7273
# setup environment
7374
ENV LANG=C.UTF-8

ros2_debian/Dockerfile.debian12

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ RUN apt-get update -y -qq && \
6363
: "remove cache" && \
6464
rm -rf /var/lib/apt/lists/*
6565

66-
# add the ROS 2 GPG key with apt and setup sources.list
67-
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
68-
sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' && \
69-
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
66+
67+
# Setup keys
68+
RUN set -eux; \
69+
export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') \
70+
&& curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb" \
71+
&& apt install /tmp/ros2-apt-source.deb
7072

7173
# setup environment
7274
ENV LANG=C.UTF-8

0 commit comments

Comments
 (0)