Skip to content

Instantly share code, notes, and snippets.

@jhurliman
Created September 13, 2022 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhurliman/d1ad9e2c78bb81adfd26606960551e7f to your computer and use it in GitHub Desktop.
Save jhurliman/d1ad9e2c78bb81adfd26606960551e7f to your computer and use it in GitHub Desktop.
Build ROS2 Galactic from source in an Ubuntu 20.04 container
FROM ubuntu:focal
ARG USER=jhurliman
ARG BASE_DIR=/home/$USER/Documents/Code/ros2/ros2_galactic
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y locales
RUN locale-gen en_US en_US.UTF-8
RUN update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG en_US.UTF-8
RUN apt-get install -y curl gnupg lsb-release
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN apt-get update && apt-get install -y \
bison \
build-essential \
cmake \
git \
libacl1-dev \
libasio-dev \
libeigen3-dev \
libtinyxml2-dev \
python3-colcon-common-extensions \
python3-flake8 \
python3-pip \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget \
sudo
RUN python3 -m pip install \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest \
setuptools
RUN useradd -ms /bin/bash $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USER
RUN mkdir -p $BASE_DIR/src
WORKDIR $BASE_DIR
RUN vcs import --input https://raw.githubusercontent.com/ros2/ros2/galactic/ros2.repos $BASE_DIR/src
ENV ROS_PYTHON_VERSION 3
RUN sudo apt-get upgrade
RUN sudo rosdep init
RUN rosdep update
RUN rosdep install --from-paths $BASE_DIR/src --ignore-src -y --skip-keys "fastcdr rti-connext-dds-5.3.1 urdfdom_headers"
RUN /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment