Skip to content

Commit 101b76c

Browse files
Matt Hansenmkhansenbot
authored andcommitted
Build and push MoveIt2 and Nav2 containers to DockerHub (issue #254)
Add space-ros-moveit2 job (issue #254) Push space-ros-nav2 image to Docker Hub (issue #254) Change names to osrf/space-ros-nav2 and osrf/space-ros-moveit2 (issue #254) Only trigger workflows for files that changed (issue #254) Change Nav2 bringup package name (issue #254) Update README files to be more clear (issue #254)
1 parent 2142034 commit 101b76c

File tree

20 files changed

+163
-61
lines changed

20 files changed

+163
-61
lines changed

.github/workflows/docker-build.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: MoveIt2 Docker build
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: ['main']
6+
paths: 'moveit2/**'
7+
pull_request:
8+
branches: ['main']
9+
paths: 'moveit2/**'
10+
schedule:
11+
- cron: '0 2 * * *'
12+
jobs:
13+
space-ros-moveit2:
14+
runs-on: ubuntu-24.04
15+
env:
16+
IMAGE_TAG: "${{ github.head_ref || github.ref_name }}"
17+
GHCR_IMAGE_NAME: "ghcr.io/space-ros/space-ros-moveit2"
18+
DOCKER_HUB_USERNAME: osrfbot
19+
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_RW_TOKEN }}
20+
DOCKER_HUB_IMAGE_NAME: "osrf/space-ros-moveit2"
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
- name: Build and tag Docker image
27+
uses: docker/build-push-action@v6
28+
with:
29+
context: moveit2
30+
push: false
31+
tags: |
32+
${{ env.DOCKER_HUB_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
33+
34+
# Login and push the main builds to GHCR
35+
- name: Login to GHCR
36+
uses: docker/login-action@v3
37+
if: ${{ github.ref_name == 'main' }}
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Push the main spaceros image to GHCR
44+
if: ${{ github.ref_name == 'main' }}
45+
run: |
46+
docker tag "$DOCKER_HUB_IMAGE_NAME:$IMAGE_TAG" "$GHCR_IMAGE_NAME:$IMAGE_TAG"
47+
docker push "$GHCR_IMAGE_NAME:$IMAGE_TAG"
48+
49+
# Push both tagged releases and the latest main builds to Dockerhub
50+
- name: Push spaceros images to Dockerhub
51+
if: ${{ github.ref_type == 'tag' || github.ref_name == 'main' }}
52+
run: |
53+
# We must login using the password and not the action, as the action only supports tokens.
54+
echo "$DOCKER_HUB_TOKEN" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
55+
docker push "$DOCKER_HUB_IMAGE_NAME:$IMAGE_TAG"
56+
57+
# Any tagged image should also be marked as "latest"
58+
- name: Push spaceros latest images to Dockerhub
59+
if: ${{ github.ref_type == 'tag' }}
60+
run: |
61+
# We must login using the password and not the action, as the action only supports tokens.
62+
echo "$DOCKER_HUB_TOKEN" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
63+
docker tag "$DOCKER_HUB_IMAGE_NAME:$IMAGE_TAG" "$DOCKER_HUB_IMAGE_NAME:latest"
64+
docker push "$DOCKER_HUB_IMAGE_NAME:latest"

.github/workflows/nav2-build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Nav2 Docker build
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches: ['main']
6+
paths: 'navigation2/**'
7+
pull_request:
8+
branches: ['main']
9+
paths: 'navigation2/**'
10+
schedule:
11+
- cron: '0 2 * * *'
12+
jobs:
13+
space-ros-nav2:
14+
runs-on: ubuntu-24.04
15+
env:
16+
IMAGE_TAG: "${{ github.head_ref || github.ref_name }}"
17+
GHCR_IMAGE_NAME: "ghcr.io/space-ros/space-ros-nav2"
18+
DOCKER_HUB_USERNAME: osrfbot
19+
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_RW_TOKEN }}
20+
DOCKER_HUB_IMAGE_NAME: "osrf/space-ros-nav2"
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
- name: Build and tag Docker image
27+
uses: docker/build-push-action@v6
28+
with:
29+
context: navigation2
30+
push: false
31+
tags: |
32+
${{ env.DOCKER_HUB_IMAGE_NAME }}:${{ env.IMAGE_TAG }}
33+
34+
# Login and push the main builds to GHCR
35+
- name: Login to GHCR
36+
uses: docker/login-action@v3
37+
if: ${{ github.ref_name == 'main' }}
38+
with:
39+
registry: ghcr.io
40+
username: ${{ github.actor }}
41+
password: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Push the main spaceros image to GHCR
44+
if: ${{ github.ref_name == 'main' }}
45+
run: |
46+
docker tag "$DOCKER_HUB_IMAGE_NAME:$IMAGE_TAG" "$GHCR_IMAGE_NAME:$IMAGE_TAG"
47+
docker push "$GHCR_IMAGE_NAME:$IMAGE_TAG"
48+
49+
# Push both tagged releases and the latest main builds to Dockerhub
50+
- name: Push nav2 images to Dockerhub
51+
if: ${{ github.ref_type == 'tag' || github.ref_name == 'main' }}
52+
run: |
53+
# We must login using the password and not the action, as the action only supports tokens.
54+
echo "$DOCKER_HUB_TOKEN" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
55+
docker push "$DOCKER_HUB_IMAGE_NAME:$IMAGE_TAG"
56+
57+
# Any tagged image should also be marked as "latest"
58+
- name: Push nav2 latest images to Dockerhub
59+
if: ${{ github.ref_type == 'tag' }}
60+
run: |
61+
# We must login using the password and not the action, as the action only supports tokens.
62+
echo "$DOCKER_HUB_TOKEN" | docker login --username "$DOCKER_HUB_USERNAME" --password-stdin
63+
docker tag "$DOCKER_HUB_IMAGE_NAME:$IMAGE_TAG" "$DOCKER_HUB_IMAGE_NAME:latest"
64+
docker push "$DOCKER_HUB_IMAGE_NAME:latest"

moveit2/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# MoveIt2 Docker Image
2+
The MoveIt2 Docker image can be pulled directly from Docker Hub [osrf/space-ros-moveit2](https://hub.docker.com/r/osrf/space-ros-moveit2/tags) for use in space applications. The image is based on the Space ROS docker image [osrf/space-ros:latest](https://hub.docker.com/r/osrf/space-ros/tags) as its base image.
23

3-
The MoveIt2 Docker image uses the Space ROS docker image (*openrobotics/spaceros:latest*) as its base image.
4-
The MoveIt2 Dockerfile installs all of the prerequisite system dependencies to build MoveIt2 (and Moveit2 tutorials) and then pulls and builds the latest MoveIt2 and Moveit2 tutorials source code.
4+
Because the build can take over an hour, it's recommended to use the pre-built Docker Hub image for creating demos, however the MoveIt2 Docker image can also be built from source using the instructions below, so that it can be customized for a space application.
55

66
## Building the MoveIt2 Image
7+
The MoveIt2 *Dockerfile* installs all of the prerequisite system dependencies to build MoveIt2 (and Moveit2 tutorials) and then pulls and builds the latest MoveIt2 and Moveit2 tutorials source code.
78

89
To build the docker image, run:
910

@@ -27,7 +28,7 @@ For example, to build an image based on the `osrf/space-ros:jazzy-2025.04.0` ima
2728
SPACE_ROS_IMAGE="osrf/space-ros:jazzy-2025.04.0" MOVEIT2_TAG="jazzy-2025.04.0" ./build.sh
2829
```
2930

30-
The build process will take about 45 minutes, depending on the host computer.
31+
The build process will take about 45-90 minutes, depending on the host computer.
3132

3233
## Running the MoveIt2 Docker Image in a Container
3334

@@ -41,11 +42,11 @@ The output will look something like this:
4142

4243
```bash
4344
REPOSITORY TAG IMAGE ID CREATED SIZE
44-
openrobotics/moveit2 latest bd7342baeff2 4 hours ago 5.49GB
45+
osrf/space-ros-moveit2 latest bd7342baeff2 4 hours ago 5.49GB
4546
osrf/space-ros latest 18a3c6709c93 6 hours ago 1.37GB
4647
```
4748

48-
The new image is named **openrobotics/moveit2:latest**.
49+
The new image is named **osrf/space-ros-moveit2:latest**.
4950

5051
There is a run.sh script provided for convenience that will run the spaceros image in a container.
5152

@@ -59,7 +60,6 @@ You'll now be running inside the container and should see a prompt similar to th
5960
```
6061
spaceros-user@8e73b41a4e16:~/moveit2#
6162
```
63+
At this point, you can run the MoveIt2 tutorials (not covered here), or build your own application on top of this image.
6264

63-
## Running the Space ROS Space Robots Demos
64-
65-
Once you have tested that MoveIt2 works, you are ready to run some of the other [Space ROS space robot demos](../space_robots/README.md).
65+
For examples using this image, see the [space-ros/demos](https://github.com/space-ros/demos) repository.

moveit2/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

3-
ORG=openrobotics
4-
IMAGE=moveit2
3+
ORG=osrf
4+
IMAGE=space-ros-moveit2
55
TAG=${MOVEIT2_TAG:-"latest"}
66

77
VCS_REF=""

moveit2/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# docker
66
# an X server
77

8-
IMG_NAME=openrobotics/moveit2
8+
IMG_NAME=osrf/space-ros-moveit2
99
IMG_TAG=latest
1010

1111
# Replace `/` with `_` to comply with docker container naming

nav2_demo/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# VCS_REF - The git revision of the Space ROS source code (no default value).
2020
# VERSION - The version of Space ROS (default: "preview")
2121

22-
FROM osrf/space_nav2:latest
22+
FROM osrf/space-ros-nav2:latest
2323

2424
# Define arguments used in the metadata definition
2525
ARG VCS_REF

nav2_demo/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ First build this container using the build script
88
./build.sh
99
```
1010

11-
There will now be a docker image called "osrf/space_nav2_demo:latest".
11+
There will now be a docker image called "osrf/space-ros-nav2-demo:latest".
1212

1313
## Run the Mars Rover demo with Nav2 and SLAM toolbox
1414

@@ -18,27 +18,27 @@ Follow the instructions to build and run the mars rover demo in [space-robots/RE
1818

1919
## Terminal 2 - launch Nav2
2020

21-
Start the space_nav2 container and launch the navigation2 nodes:
21+
Start the space-ros-nav2 container and launch the navigation2 nodes:
2222

2323
```
2424
./run.sh
25-
ros2 launch space_nav2_bringup navigation_launch.py use_sim_time:=True params_file:=nav2_params.yaml
25+
ros2 launch space_ros_nav2_bringup navigation_launch.py use_sim_time:=True params_file:=nav2_params.yaml
2626
```
2727

2828
## Terminal 3 - launch localization with map
2929

3030
```
31-
docker exec -it osrf_space_nav2_demo bash
31+
docker exec -it osrf_space-ros-nav2-demo bash
3232
source install/setup.bash
33-
ros2 launch space_nav2_bringup localization_launch.py use_sim_time:=True map:=mars_map.yaml params_file:=nav2_params.yaml
33+
ros2 launch space_ros_nav2_bringup localization_launch.py use_sim_time:=True map:=mars_map.yaml params_file:=nav2_params.yaml
3434
```
3535

3636
## Terminal 4 - launch Rviz
3737

38-
Exec into the same space_nav2 container and launch Rviz2:
38+
Exec into the same space-ros-nav2 container and launch Rviz2:
3939

4040
```
41-
docker exec -it -e DISPLAY osrf_space_nav2_demo bash
41+
docker exec -it -e DISPLAY osrf_space-ros-nav2-demo bash
4242
source /opt/ros/humble/setup.bash
4343
source install/setup.bash
4444
ros2 launch nav2_bringup rviz_launch.py

nav2_demo/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
ORG=osrf
4-
IMAGE=space_nav2_demo
4+
IMAGE=space-ros-nav2-demo
55
TAG=latest
66

77
VCS_REF=""

nav2_demo/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# docker
66
# an X server
77

8-
IMG_NAME=osrf/space_nav2_demo
8+
IMG_NAME=osrf/space-ros-nav2-demo
99
IMG_TAG=latest
1010

1111
# Replace `/` with `_` to comply with docker container naming

0 commit comments

Comments
 (0)