From 3823d7e6ccb3848f264608add12bcb5239565406 Mon Sep 17 00:00:00 2001 From: Max Polzin Date: Tue, 28 Nov 2023 18:37:56 +0100 Subject: [PATCH] Initial commit. --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ Dockerfile | 12 ++++++++++++ LICENSE | 29 +++++++++++++++++++++++++++++ build.sh | 5 +++++ ros_entrypoint.sh | 8 ++++++++ run.sh | 12 ++++++++++++ 6 files changed, 101 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100755 build.sh create mode 100755 ros_entrypoint.sh create mode 100755 run.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4faa7e7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: ci + +on: + push: + branches: + - 'main' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to DockerHub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/rosblox/${{ github.event.repository.name }}:humble diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b81b729 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +ARG ROS_DISTRO=humble + +FROM ros:${ROS_DISTRO}-ros-core + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ros-${ROS_DISTRO}-foxglove-bridge \ + && rm -rf /var/lib/apt/lists/* + +COPY ros_entrypoint.sh . + +RUN echo 'source /opt/ros/humble/setup.bash; ros2 launch foxglove_bridge foxglove_bridge_launch.xml' >> /run.sh && chmod +x /run.sh +RUN echo 'alias run="su - ros /run.sh"' >> /etc/bash.bashrc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f807366 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2022, ROSbloX +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..028fcb4 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")" + +docker build --progress=plain -t ghcr.io/rosblox/${REPOSITORY_NAME}:humble . \ No newline at end of file diff --git a/ros_entrypoint.sh b/ros_entrypoint.sh new file mode 100755 index 0000000..fe16d31 --- /dev/null +++ b/ros_entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +id -u ros &>/dev/null || adduser --quiet --disabled-password --gecos '' --uid ${UID:=1000} --uid ${GID:=1000} ros + +source /opt/ros/${ROS_DISTRO}/setup.bash + +exec "$@" diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..fee9ca9 --- /dev/null +++ b/run.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")" + +docker run -it --rm \ +--network=host \ +--ipc=host \ +--pid=host \ +--env UID=$(id -u) \ +--env GID=$(id -g) \ +--privileged \ +ghcr.io/rosblox/${REPOSITORY_NAME}:humble