Skip to content

Instantly share code, notes, and snippets.

@hoffmann-stefan
Created April 15, 2023 11:58
Show Gist options
  • Save hoffmann-stefan/b951fa204417494e637fc744899e0153 to your computer and use it in GitHub Desktop.
Save hoffmann-stefan/b951fa204417494e637fc744899e0153 to your computer and use it in GitHub Desktop.
# see https://hub.docker.com/_/ros/ for infos on official ros docker images
FROM ros:humble-ros-base-jammy
# install dotnet-sdk-6.0 via Ubuntu package manager feeds,
# see https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2204
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
# Install prerequisites
&& apt-get install -y --no-install-recommends \
wget \
dotnet-sdk-6.0 \
\
# Cleanup
&& rm -rf /var/lib/apt/lists/*
# create workspace and import source code
RUN mkdir -p ~/ros2_dotnet_ws/src \
&& cd ~/ros2_dotnet_ws \
&& wget https://raw.githubusercontent.com/ros2-dotnet/ros2_dotnet/master/ros2_dotnet.repos \
&& sed -i 's/foxy/humble/' ros2_dotnet.repos \
&& vcs import ~/ros2_dotnet_ws/src < ros2_dotnet.repos
# build workspace
RUN . /opt/ros/$ROS_DISTRO/setup.sh \
&& cd ~/ros2_dotnet_ws \
&& colcon build
# build with
$ docker build . -t ros2_dotnet:humble-ros-jammy
# run container with:
$ docker run --rm -it ros2_dotnet:humble-ros-jammy
# execute in container
$ source ~/ros2_dotnet_ws/install/setup.bash
$ ros2 run rcldotnet_examples rcldotnet_listener
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment