-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ROSDISTRO_PKGS_SYNC_DATE environment variable
- Loading branch information
1 parent
86b2fec
commit c3e022c
Showing
8 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# syntax=docker/dockerfile:1 | ||
ARG BASE_IMAGE=docker.io/ubuntu:noble-20241015 | ||
# hadolint ignore=DL3006 | ||
FROM ${BASE_IMAGE} AS base | ||
|
||
FROM base AS download | ||
|
||
ARG RAW_GITHUBUSERCONTENT_BASE_URL | ||
|
||
# download gpg key | ||
RUN <<EOF | ||
apt-get update | ||
apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl | ||
curl -sSL "${RAW_GITHUBUSERCONTENT_BASE_URL}/ros/rosdistro/master/ros.key" \ | ||
-o /usr/share/keyrings/ros2-latest-archive-keyring.gpg | ||
EOF | ||
|
||
FROM base AS ros-core | ||
|
||
ARG ROS_PACKAGES_URI | ||
ARG ROSDISTRO_PKGS_SYNC_DATE | ||
|
||
COPY --from=download /usr/share/keyrings/ros2-latest-archive-keyring.gpg /usr/share/keyrings/ros2-latest-archive-keyring.gpg | ||
|
||
# setup timezone | ||
RUN echo 'Etc/UTC' > /etc/timezone && \ | ||
ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ | ||
apt-get update && \ | ||
apt-get install -q -y --no-install-recommends tzdata && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# install packages | ||
RUN apt-get update && apt-get install -q -y --no-install-recommends \ | ||
dirmngr \ | ||
gnupg2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# setup sources.list | ||
RUN echo "deb [ signed-by=/usr/share/keyrings/ros2-latest-archive-keyring.gpg ] ${ROS_PACKAGES_URI} noble main" > /etc/apt/sources.list.d/ros2-latest.list | ||
|
||
# setup environment | ||
ENV LANG=C.UTF-8 | ||
ENV LC_ALL=C.UTF-8 | ||
|
||
ENV ROSDISTRO_PKGS_SYNC_DATE=$ROSDISTRO_PKGS_SYNC_DATE | ||
ENV ROS_DISTRO=rolling | ||
|
||
# install ros2 packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ros-rolling-ros-core=0.11.0-1* \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# setup entrypoint | ||
COPY ./ros_entrypoint.sh / | ||
|
||
ENTRYPOINT ["/ros_entrypoint.sh"] | ||
CMD ["bash"] | ||
|
||
FROM ros-core AS ros-base | ||
|
||
ARG RAW_GITHUBUSERCONTENT_BASE_URL | ||
|
||
# install bootstrap tools | ||
RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
build-essential \ | ||
git \ | ||
python3-colcon-common-extensions \ | ||
python3-colcon-mixin \ | ||
python3-rosdep \ | ||
python3-vcstool \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# bootstrap rosdep | ||
RUN rosdep init && \ | ||
rosdep update --rosdistro "${ROS_DISTRO}" | ||
|
||
# setup colcon mixin and metadata | ||
RUN colcon mixin add default \ | ||
"${RAW_GITHUBUSERCONTENT_BASE_URL}/colcon/colcon-mixin-repository/master/index.yaml" && \ | ||
colcon mixin update && \ | ||
colcon metadata add default \ | ||
"${RAW_GITHUBUSERCONTENT_BASE_URL}/colcon/colcon-metadata-repository/master/index.yaml" && \ | ||
colcon metadata update | ||
|
||
# install ros2 packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ros-rolling-ros-core=0.11.0-1* \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM ros-base AS perception | ||
|
||
# install ros2 packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ros-rolling-ros-base=0.11.0-1* \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM ros-base AS desktop | ||
|
||
# install ros2 packages | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
ros-rolling-desktop=0.11.0-1* \ | ||
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
variable "TAG_PREFIX" { | ||
default = "docker.io/polymathrobotics/ros" | ||
} | ||
|
||
# There's no darwin-based Docker, so if we're running on macOS, change the platform to linux | ||
variable "LOCAL_PLATFORM" { | ||
default = regex_replace("${BAKE_LOCAL_PLATFORM}", "^(darwin)", "linux") | ||
} | ||
|
||
variable "ROS_PACKAGE" { | ||
default = ["ros-core", "ros-base", "perception", "desktop"] | ||
} | ||
|
||
target "_common" { | ||
args = { | ||
ROS_PACKAGES_URI = "http://packages.ros.org/ros2/ubuntu" | ||
RAW_GITHUBUSERCONTENT_BASE_URL = "https://raw.githubusercontent.com" | ||
ROSDISTRO_PKGS_SYNC_DATE = "${formatdate("YYYY-MM-DD", timestamp())}" | ||
} | ||
dockerfile = "Containerfile" | ||
labels = { | ||
"org.opencontainers.image.source" = "https://github.com/polymathrobotics/oci/blob/main/ros/jazzy/ubuntu/noble/Containerfile" | ||
"org.opencontainers.image.licenses" = "Apache-2.0" | ||
"org.opencontainers.image.description" = "The Robot Operating System (ROS) is an open source project for building robot applications." | ||
"org.opencontainers.image.title" = "${TAG_PREFIX}" | ||
"org.opencontainers.image.created" = "${timestamp()}" | ||
"dev.polymathrobotics.image.readme-filepath" = "ros/README.md" | ||
} | ||
} | ||
|
||
target "local" { | ||
inherits = ["_common"] | ||
name = "local-${ros_package}" | ||
matrix = { | ||
ros_package = ROS_PACKAGE | ||
} | ||
target = ros_package | ||
tags = [ | ||
"${TAG_PREFIX}:rolling-${ros_package}-noble" | ||
] | ||
platforms = ["${LOCAL_PLATFORM}"] | ||
} | ||
|
||
target "default" { | ||
inherits = ["_common"] | ||
name = "default-${ros_package}" | ||
matrix = { | ||
ros_package = ROS_PACKAGE | ||
} | ||
target = ros_package | ||
tags = [ | ||
"${TAG_PREFIX}:rolling-${ros_package}-noble" | ||
] | ||
platforms = ["linux/amd64", "linux/arm64/v8"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# setup ros2 environment | ||
source "/opt/ros/$ROS_DISTRO/setup.bash" -- | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
describe os_env('ROS_DISTRO') do | ||
its('content') { should eq 'rolling' } | ||
end | ||
|
||
describe os_env('LANG') do | ||
its('content') { should eq 'C.UTF-8' } | ||
end | ||
|
||
describe os_env('ROSDISTRO_PKGS_SYNC_DATE') do | ||
its('content') { should match /^\d{4}-\d{2}-\d{2}$/ } | ||
end | ||
|
||
describe file('/usr/share/keyrings/ros2-latest-archive-keyring.gpg') do | ||
it { should exist } | ||
end | ||
|
||
describe file('/ros_entrypoint.sh') do | ||
it { should exist } | ||
end | ||
|
||
describe command("su --login --command \"source /opt/ros/$ROS_DISTRO/setup.bash && ros2 -h\"") do | ||
its('exit_status') { should cmp 0 } | ||
its('stdout') { should match(/usage: ros2/) } | ||
end | ||
|
||
describe file('/ros_entrypoint.sh') do | ||
it { should exist } | ||
its('content') { should match %r{source "/opt/ros/\$ROS_DISTRO/setup\.bash"} } | ||
end | ||
|
||
# docker.io/polymathrobotics/ros:rolling-ros-core-noble | ||
control 'ros-core' do | ||
only_if('ros-core') do | ||
input('test_container_image').include?('ros:rolling-ros-core-noble') | ||
end | ||
|
||
%w( | ||
colcon | ||
rosdep | ||
).each do |cmd| | ||
describe command(cmd) do | ||
it { should_not exist } | ||
end | ||
end | ||
end | ||
|
||
# docker.io/polymathrobotics/ros:rolling-ros-base-noble | ||
control 'ros-base' do | ||
only_if('ros-base') do | ||
input('test_container_image').include?('ros:rolling-ros-base-noble') | ||
end | ||
|
||
describe command('colcon') do | ||
it { should exist } | ||
end | ||
end | ||
|
||
# docker.io/polymathrobotics/ros:rolling-perception-noble | ||
control 'perception' do | ||
only_if('perception') do | ||
input('test_container_image').include?('ros:rolling-perception-noble') | ||
end | ||
|
||
describe command('colcon') do | ||
it { should exist } | ||
end | ||
end | ||
|
||
# docker.io/polymathrobotics/ros:rolling-desktop-noble | ||
control 'desktop' do | ||
only_if('desktop') do | ||
input('test_container_image').include?('ros:rolling-desktop-noble') | ||
end | ||
|
||
describe command('colcon') do | ||
it { should exist } | ||
end | ||
end |