Skip to content

Commit

Permalink
interim checkin of a Dockerfile to build packages on top of debian pr…
Browse files Browse the repository at this point in the history
…ovided ones on 22.04 base image
  • Loading branch information
lucasw committed May 23, 2022
1 parent 3991c21 commit 28d8081
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ubuntu_20_04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ jobs:
cd staging
../ros_from_src/build.sh
- name: docker build 20.04
- name: docker build from source 20.04
run: |
cd ros_from_src
docker build --build-arg IMAGE=ubuntu:20.04 --build-arg ROSCONSOLE=https://github.com/ros/rosconsole --build-arg PYTHON_MINOR_VERSION=8 . -t ros2004
- name: docker build 22.04
- name: docker build from source 22.04
run: |
cd ros_from_src
docker build --build-arg IMAGE=ubuntu:22.04 --build-arg PYTHON_MINOR_VERSION=10 . -t ros2204
- name: docker build from source and debian 22.04
run: |
cd ros_from_src/ubuntu_2204
docker build . -t ros_debian_2204
106 changes: 106 additions & 0 deletions ubuntu_2204/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
ARG IMAGE=ubuntu:22.04
FROM ${IMAGE}
ARG IMAGE
RUN echo ${IMAGE}

ENV DEBIAN_FRONTEND="noninteractive"

# be able to source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh

RUN apt-get update -y
RUN apt-get upgrade -y
RUN apt-get install -y apt-utils

# apt installs
RUN apt install -y git
RUN apt install -y ros-*
RUN apt install -y catkin-lint cython3 libapriltag-dev libceres-dev libfrei0r-ocaml-dev
RUN apt install -y libgeographic-dev libgmock-dev libgoogle-glog-dev libgst-dev
RUN apt install -y libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
RUN apt install -y libimage-view-dev liborocos-bfl-dev libpcl-ros-dev libqt5svg5-dev libqt5websockets5-dev
RUN apt install -y libqt5x11extras5-dev libqwt-qt5-dev libsdl-image1.2-dev
RUN apt install -y libspnav-dev liburdfdom-dev libuvc-dev libv4l-dev libyaml-cpp-dev
RUN apt install -y python-is-python3 python3-tf2-geometry-msgs python3-venv vim curl jq

ENV DEST=/other/install
RUN mkdir $DEST -p
ENV SRC=/other/src
RUN mkdir $SRC -p

WORKDIR $SRC
RUN git clone https://github.com/lucasw/ros_from_src.git
WORKDIR $SRC/ros_from_src/ubuntu_2204
# make git clone work through vcs without git credentials
RUN sed -i 's/[email protected]:/https:\/\/github.com\//' base_repos.yaml

WORKDIR $SRC
RUN git clone https://github.com/dirk-thomas/vcstool.git
WORKDIR $SRC/vcstool
RUN python3 setup.py install --prefix=$DEST --record install_manifest.txt --single-version-externally-managed

WORKDIR $SRC
RUN git clone https://github.com/osrf/osrf_pycommon.git
WORKDIR $SRC/osrf_pycommon
RUN ls -l
RUN python3 setup.py install --prefix=$DEST --record install_manifest.txt --single-version-externally-managed

WORKDIR $SRC
RUN git clone https://github.com/lucasw/catkin_tools.git --branch sanitize_cmake_prefix_path
WORKDIR $SRC/catkin_tools
RUN python3 setup.py install --prefix=$DEST --record install_manifest.txt --single-version-externally-managed

WORKDIR $SRC
RUN python --version | awk '{print $2}' | cut -d'.' -f1
RUN python --version | awk '{print $2}' | cut -d'.' -f2
# TODO(lucasw) these aren't working
# RUN export PYTHON_MAJOR_VERSION=`python --version | awk '{print $2}' | cut -d'.' -f1`
# RUN export PYTHON_MINOR_VERSION=`python --version | awk '{print $2}' | cut -d'.' -f2`
# RUN PYTHON_MINOR_VERSION=`python --version | awk '{print $2}' | cut -d'.' -f2`
ARG PYTHON_MAJOR_VERSION=3
ARG PYTHON_MINOR_VERSION=10
ENV OPT_PYTHONPATH=$DEST/lib/python$PYTHON_MAJOR_VERSION.$PYTHON_MINOR_VERSION/site-packages/
RUN echo $PYTHONPATH
ENV PYTHONPATH=$OPT_PYTHONPATH
RUN echo $PYTHONPATH

ENV PATH=$DEST/bin:$PATH

# get packages and build
ENV WS=/base_catkin_ws/src
RUN mkdir $WS -p
WORKDIR $WS
RUN vcs import --shallow < $SRC/ros_from_src/ubuntu_2204/base_repos.yaml
RUN $SRC/ros_from_src/ubuntu_2204/ignore.sh

RUN echo $CMAKE_PREFIX_PATH

WORKDIR $WS/..
RUN catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release -Wno-deprecated
# split these up so can take advantage of docker layers, otherwise one failure
# means a huge rebuild
RUN catkin build -j1 fuse_core
RUN catkin build -j1 rtabmap_ros
RUN catkin build -j1 rviz
RUN catkin build -j1 plotjuggler
RUN catkin build -j1 rqt
RUN catkin build -j1 octomap_server
RUN catkin build -j1 libuvc_camera
RUN catkin build -j1 fuse_constraints
RUN catkin build -j1 people_tracking_filter
RUN catkin build -j1 laser_assembler
RUN catkin build -j1 catkin_virtualenv
RUN catkin build -j1 nmea_navsat_driver
RUN catkin build -j1 grid_map_visualization
RUN catkin build -j1 stereo_image_proc
RUN catkin build -j1 jsk_topic_tools
RUN catkin build -j1 test_catkin_virtualenv_inherited
RUN catkin build -j1 test_catkin_virtualenv_py3_isolated
RUN catkin build -j1
# rospack list won't work by itself
RUN source devel/setup.bash && rospack list

# TODO(lucasw) run tests

# TODO(lucasw) instead of git cloning the repo we're already in, copy in the repos.yaml and ignore file
# so someone could edit them and rerun the dockerfile
22 changes: 17 additions & 5 deletions ubuntu_2204/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Install many ros packages and dependencies of ros packages that will be built from source, from apt:

```
sudo apt install ros-* catkin-lint cython3 libapriltag-dev libceres-dev libfrei0r-ocaml-dev libgeographic-dev libgmock-dev libgoogle-glog-dev libgst-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libimage-view-dev liborocos-bfl-dev libpcl-ros-dev libqt5svg5-dev libqt5websockets5-dev libqt5x11extras5-dev libqwt-qt5-dev libsdl-image1.2-dev libspnav-dev liburdfdom-dev libuvc-dev libv4l-dev libyaml-cpp-dev python-is-python3 python3-tf2-geometry-msgs python3-venv vim curl jq
sudo apt install ros-* catkin-lint cython3 libapriltag-dev libceres-dev libfrei0r-ocaml-dev libgeographic-dev libgmock-dev libgoogle-glog-dev libgst-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libimage-view-dev liborocos-bfl-dev libpcl-ros-dev libqt5svg5-dev libqt5websockets5-dev libqt5x11extras5-dev libqwt-qt5-dev libsdl-image1.2-dev libspnav-dev liburdfdom-dev libuvc-dev libv4l-dev libyaml-cpp-dev python-is-python3 python3-osrf-pycommon python3-tf2-geometry-msgs python3-venv vim curl jq
```

Put this into ~/.bashrc so that vcs and catkin_tools can be found (TODO(lucasw) make them install to ~/.local/... instead like pip user installs?)
Expand All @@ -21,14 +21,17 @@ cd ~/other/src
git clone [email protected]:lucasw/ros_from_src
```

```
export DEST=$HOME/catkin_ws/other/install
export PATH=$PATH:$DEST/bin
```

vcs is very useful for managing a large set of git repos:

```
cd ~/other/src
git clone [email protected]:dirk-thomas/vcstool.git
cd vcstool
export DEST=$HOME/catkin_ws/other/install
export PATH=$PATH:$DEST/bin
python3 setup.py install --prefix=$DEST --record install_manifest.txt --single-version-externally-managed
```

Expand All @@ -48,13 +51,13 @@ cd catkin_tools
python3 setup.py install --prefix=$DEST --record install_manifest.txt --single-version-externally-managed
```

Download a bunch of repos that are not available in 22.04 through apt, some with modifications to work in 22.04:
Download a bunch of repos that are not available in 22.04 through apt, some with modifications to build in 22.04 (mostly to avoid `boost::placeholders::_N` and bind.hpp warnings and errors, and building with C++17 to avoid log4cxx 0.12 build errors):

```
mkdir -p ~/base_catkin_ws/src
cd ~/base_catkin_ws/src
ln -s ~/other/src/ros_from_src/ubuntu_2204/base_repos.yaml
vcs import < base_repos.yaml
vcs import --shallow < base_repos.yaml
# ignore repos that aren't yet building in 22.04
~/other/src/ros_from_src/ubuntu_2204/ignore.sh
```
Expand All @@ -71,3 +74,12 @@ source devel/setup.bash
```

TODO(lucasw) see if rosdep install works

---


Run the above in docker:
```
cd ros_from_src/ubuntu_2204
docker build . -t ros_debian_2204
```

0 comments on commit 28d8081

Please sign in to comment.