From 7350fc9afea2496d1dd98c2e0b911098e5b0cf80 Mon Sep 17 00:00:00 2001 From: Daisuke Sato Date: Sat, 30 Jul 2022 01:30:05 +0900 Subject: [PATCH] feat: Add ROS 2 Humble Dockerfile (#56) * feat: Add ROS 2 Humble Dockerfile * ci: Add humble build test * fix: Remove simulation packages installation to avoid error on arm64 * feat: Add ign package --- .github/workflows/deploy.yml | 3 +- .github/workflows/test.yml | 11 +++++-- README.md | 18 +++++++++++ humble-arm64/Dockerfile | 59 ++++++++++++++++++++++++++++++++++++ humble/Dockerfile | 59 ++++++++++++++++++++++++++++++++++++ 5 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 humble-arm64/Dockerfile create mode 100644 humble/Dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5fdb2db..d9801a6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,6 +9,7 @@ on: - ".github/workflows/deploy.yml" schedule: - cron: "7 4 * * 0" # Weekly on Sundays at 13:07 (JST) + workflow_dispatch: env: DOCKER_USERNAME: tiryoh @@ -21,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - ros-distro: [foxy, galactic, rolling] + ros-distro: [foxy, galactic, humble, rolling] arch: [arm64, amd64] runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e072d8f..2dab21d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ on: - ".github/workflows/test.yml" schedule: - cron: "0 2 * * 0" # Weekly on Sundays at 02:00 + workflow_dispatch: env: DOCKER_USERNAME: tiryoh @@ -19,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - ros-distro: [foxy, galactic, rolling] + ros-distro: [foxy, galactic, humble, rolling] arch: [arm64, amd64] runs-on: ubuntu-latest steps: @@ -55,7 +56,13 @@ jobs: env: DOCKER_TAGNAME: ${{ matrix.ros-distro }}-${{ matrix.arch }} run: | - cd ${DOCKER_TAGNAME%-amd64} && docker build ${{ steps.docker-build-option.outputs.labels }} -t $DOCKER_USERNAME/$DOCKER_IMAGENAME:$DOCKER_TAGNAME . + if [[ -d ${DOCKER_TAGNAME%-amd64} ]]; then + cd ${DOCKER_TAGNAME%-amd64} && docker build ${{ steps.docker-build-option.outputs.labels }} -t $DOCKER_USERNAME/$DOCKER_IMAGENAME:$DOCKER_TAGNAME . + elif [[ -d ${DOCKER_TAGNAME%-arm64} ]]; then + cd ${DOCKER_TAGNAME%-arm64} && docker build ${{ steps.docker-build-option.outputs.labels }} -t $DOCKER_USERNAME/$DOCKER_IMAGENAME:$DOCKER_TAGNAME . + else + exit 1 + fi - name: List docker images run: | diff --git a/README.md b/README.md index 1f509a3..b72cab8 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ Change the `shm-size` value depending on the situation. docker run -p 6080:80 --shm-size=512m tiryoh/ros2-desktop-vnc:foxy ``` +__NOTE__: `--security-opt seccomp=unconfined` flag is required to launch humble image. See https://github.com/Tiryoh/docker-ros2-desktop-vnc/pull/56. + +``` +docker run -p 6080:80 --shm-size=512m --security-opt seccomp=unconfined tiryoh/ros2-desktop-vnc:humble +``` + Browse http://127.0.0.1:6080/. ![Image from Gyazo](https://i.gyazo.com/ab43ab3f6dc10b5186416499e49d0bbe.jpg) @@ -54,12 +60,24 @@ cd foxy && docker build -t tiryoh/ros2-desktop-vnc:foxy . cd galactic && docker build -t tiryoh/ros2-desktop-vnc:galactic . ``` +* humble +``` +cd humble && docker build -t tiryoh/ros2-desktop-vnc:humble . +``` + +* rolling +``` +cd rolling && docker build -t tiryoh/ros2-desktop-vnc:rolling . +``` + ## Docker tags on hub.docker.com * ~~[`dashing`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=dashing) which is based on [`dashing/Dockerfile`](./dashing/Dockerfile)~~ deprecated * ~~[`eloquent`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=eloquent) which is based on [`eloquent/Dockerfile`](./eloquent/Dockerfile)~~ deprecated * [`foxy`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=foxy), [`latest`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=latest) which is based on [`foxy/Dockerfile`](./foxy/Dockerfile) * [`galactic`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=galactic) which is based on [`galactic/Dockerfile`](./galactic/Dockerfile) +* [`humble`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=humble) which is based on [`humble/Dockerfile`](./humble/Dockerfile) +* [`rolling`](https://hub.docker.com/r/tiryoh/ros2-desktop-vnc/tags?page=1&name=rolling) which is based on [`rolling/Dockerfile`](./rolling/Dockerfile) Docker tags and build logs are listed on this page. https://github.com/Tiryoh/docker-ros2-desktop-vnc/wiki diff --git a/humble-arm64/Dockerfile b/humble-arm64/Dockerfile new file mode 100644 index 0000000..544df99 --- /dev/null +++ b/humble-arm64/Dockerfile @@ -0,0 +1,59 @@ +# Copyright 2020-2022 Tiryoh +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM tiryoh/ubuntu-desktop-lxde-vnc:jammy +LABEL maintainer="Tiryoh" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get update -q && \ + apt-get upgrade -yq && \ + DEBIAN_FRONTEND=noninteractive apt-get install -yq wget curl git build-essential vim sudo lsb-release locales bash-completion tzdata gosu && \ + rm -rf /var/lib/apt/lists/* +RUN useradd --create-home --home-dir /home/ubuntu --shell /bin/bash --user-group --groups adm,sudo ubuntu && \ + echo ubuntu:ubuntu | chpasswd && \ + echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +ARG ROS_DISTRO=humble +ARG INSTALL_PACKAGE=desktop + +RUN apt-get update -q && \ + apt-get install -y curl gnupg2 lsb-release && \ + curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \ + apt-get update -q && \ + apt-get install -y ros-${ROS_DISTRO}-${INSTALL_PACKAGE} \ + python3-argcomplete \ + python3-colcon-common-extensions \ + python3-rosdep python3-vcstool && \ + rosdep init && \ + rm -rf /var/lib/apt/lists/* + +# Install simulation package only on amd64 +# Not ready for arm64 for now (July 28th, 2020) +# https://github.com/Tiryoh/docker-ros2-desktop-vnc/pull/56#issuecomment-1196359860 +# RUN apt-get update -q && \ +# apt-get install -y \ +# ros-${ROS_DISTRO}-gazebo-ros-pkgs \ +# ros-${ROS_DISTRO}-ros-ign && \ +# rm -rf /var/lib/apt/lists/* + +RUN gosu ubuntu rosdep update && \ + grep -F "source /opt/ros/${ROS_DISTRO}/setup.bash" /home/ubuntu/.bashrc || echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/ubuntu/.bashrc && \ + sudo chown ubuntu:ubuntu /home/ubuntu/.bashrc + +RUN echo 'sed -i -e "s/palette_color_4=rgb([0-9,]*)/palette_color_4=rgb(51,61,255)/g" $HOME/.config/lxterminal/lxterminal.conf' > /usr/local/bin/update-lxterminal.sh && \ + chmod +x /usr/local/bin/update-lxterminal.sh + +ENV USER ubuntu diff --git a/humble/Dockerfile b/humble/Dockerfile new file mode 100644 index 0000000..8ac04b2 --- /dev/null +++ b/humble/Dockerfile @@ -0,0 +1,59 @@ +# Copyright 2020-2022 Tiryoh +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM tiryoh/ubuntu-desktop-lxde-vnc:jammy +LABEL maintainer="Tiryoh" + +SHELL ["/bin/bash", "-c"] + +RUN apt-get update -q && \ + apt-get upgrade -yq && \ + DEBIAN_FRONTEND=noninteractive apt-get install -yq wget curl git build-essential vim sudo lsb-release locales bash-completion tzdata gosu && \ + rm -rf /var/lib/apt/lists/* +RUN useradd --create-home --home-dir /home/ubuntu --shell /bin/bash --user-group --groups adm,sudo ubuntu && \ + echo ubuntu:ubuntu | chpasswd && \ + echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +ARG ROS_DISTRO=humble +ARG INSTALL_PACKAGE=desktop + +RUN apt-get update -q && \ + apt-get install -y curl gnupg2 lsb-release && \ + curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \ + apt-get update -q && \ + apt-get install -y ros-${ROS_DISTRO}-${INSTALL_PACKAGE} \ + python3-argcomplete \ + python3-colcon-common-extensions \ + python3-rosdep python3-vcstool && \ + rosdep init && \ + rm -rf /var/lib/apt/lists/* + +# Install simulation package only on amd64 +# Not ready for arm64 for now (July 28th, 2020) +# https://github.com/Tiryoh/docker-ros2-desktop-vnc/pull/56#issuecomment-1196359860 +RUN apt-get update -q && \ + apt-get install -y \ + ros-${ROS_DISTRO}-gazebo-ros-pkgs \ + ros-${ROS_DISTRO}-ros-ign && \ + rm -rf /var/lib/apt/lists/* + +RUN gosu ubuntu rosdep update && \ + grep -F "source /opt/ros/${ROS_DISTRO}/setup.bash" /home/ubuntu/.bashrc || echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/ubuntu/.bashrc && \ + sudo chown ubuntu:ubuntu /home/ubuntu/.bashrc + +RUN echo 'sed -i -e "s/palette_color_4=rgb([0-9,]*)/palette_color_4=rgb(51,61,255)/g" $HOME/.config/lxterminal/lxterminal.conf' > /usr/local/bin/update-lxterminal.sh && \ + chmod +x /usr/local/bin/update-lxterminal.sh + +ENV USER ubuntu