Skip to content

Commit

Permalink
Follow new structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxpolzin committed Nov 26, 2024
1 parent a770f0a commit 0e8a108
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ jobs:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
ROS_DISTRO=humble
tags: ghcr.io/rosblox/${{ github.event.repository.name }}:humble
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:humble
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
ARG ROS_DISTRO
ARG ROS_DISTRO=humble

FROM ros:${ROS_DISTRO}-ros-core

RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-joy-linux \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/*

COPY ros_entrypoint.sh .

ENV LAUNCH_COMMAND='ros2 run joy_linux joy_linux_node'

RUN echo 'alias run="su - ros --whitelist-environment=\"ROS_DOMAIN_ID\" /run.sh"' >> /etc/bash.bashrc && \
echo "source /opt/ros/$ROS_DISTRO/setup.bash; echo UID: $UID; echo ROS_DOMAIN_ID: $ROS_DOMAIN_ID; $LAUNCH_COMMAND" >> /run.sh && chmod +x /run.sh
8 changes: 7 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
docker build -t ghcr.io/rosblox/ros-joy-linux:humble .
#!/bin/bash

export BUILDKIT_PROGRESS=plain

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

docker compose -f $SCRIPT_DIR/docker-compose.yml build docker build -t ghcr.io/rosblox/ros-joy-linux:humble .
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
ros-joy-linux:
image: ghcr.io/rosblox/ros-joy-linux:humble
build:
context: .
dockerfile: Dockerfile
restart: always
network_mode: "host"
ipc: host
pid: host
volumes:
- /dev/input:/dev/input
environment:
- UID=${HOST_UID}
- ROS_DOMAIN_ID
command: su - ros --whitelist-environment=ROS_DOMAIN_ID /run.sh
8 changes: 8 additions & 0 deletions ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

id -u ros &>/dev/null || adduser --quiet --disabled-password --gecos '' --uid ${UID:=1000} ros

source /opt/ros/${ROS_DISTRO}/setup.bash

exec "$@"
10 changes: 10 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

REPOSITORY_NAME="$(basename "$(dirname -- "$( readlink -f -- "$0"; )")")"

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

export HOST_UID=$(id -u)

docker compose -f $SCRIPT_DIR/docker-compose.yml run \
${REPOSITORY_NAME} bash

0 comments on commit 0e8a108

Please sign in to comment.