Skip to content

Commit

Permalink
feat: added support for docker (#514)
Browse files Browse the repository at this point in the history
* feat: add dockerfile for ros2 workspace setup and colcon build

* ci: add ci pipeline for docker image build and ros2 colcon build

* refactor: dockerfile use multi-stage builds to only include necessary files

* refactor: dockerfile use smaller base image to make image size smaller

---------

Co-authored-by: Andreas Kluge Svendsrud <[email protected]>
Co-authored-by: Anders Høgden <[email protected]>
  • Loading branch information
3 people authored Jan 26, 2025
1 parent 05d6431 commit 12787c8
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci-docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
push:
tags:
- 'v*'
jobs:
docker-ros:
runs-on: ubuntu-latest
steps:
- uses: ika-rwth-aachen/[email protected]
with:
base-image: rwthika/ros2:humble
target: dev # Specify the dev stage
image-tag: ${{ github.ref_name }}
platform: linux/arm64,linux/amd64
2 changes: 1 addition & 1 deletion .github/workflows/industrial-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jobs:
call_reusable_workflow:
uses: vortexntnu/vortex-ci/.github/workflows/reusable-industrial-ci.yml@main
with:
upstream_workspace: './vortex_auv.repos'
upstream_workspace: './dependencies.repos'
before_install_target_dependencies: 'cp ./requirements.sh /tmp/requirements.sh && chmod +x /tmp/requirements.sh && /tmp/requirements.sh'
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "docker/docker-ros"]
path = docker/docker-ros
url = https://github.com/ika-rwth-aachen/docker-ros.git
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@

This repo contains software for operating UUVs, developed by students at NTNU. The software is based on the ROS2 Humble framework, and aims to be hardware independent. Although the main focus of Vortex is autonomous operation, this software stack supports both AUV and ROV operations.

## Docker
This project uses the (docker-ros)[https://github.com/ika-rwth-aachen/docker-ros] repository for building and managing Docker images. The docker-ros repository is included as a Git submodule and is configured to build images locally.

### Prerequisites
1. Docker must be installed on your system. Follow the instructions [here](https://docs.docker.com/get-docker/) to install Docker.

### Cloning
1. To clone this repository with the docker-ros submodule, use the following command:
```bash
git clone --recurse-submodules https://github.com/vortexntnu/vortex-auv.git
```
Alternatively, if you have already cloned the repository, run the following command to initialize the submodule:
```bash
git submodule update --init --recursive
```
2. Once added, docker-ros provide a script to build Docker images locally.
### Building and Running
1. Run the following command to build the Docker image:
```bash
./entrypoint.sh
```
Or, you can pull the appropriate image from (Github packages)[https://github.com/vortexntnu/vortex-auv/pkgs/container/vortex-auv]
2. Once the image is built, run the following command to start the container:
```bash
docker run -it --privileged --network host --ipc=host "auv-image:latest"
```
NOTE: If running on MacOS, the `--network host` flag is not supported.

## Documentation
* TODO: Drivers and hardware specifics for each drone will be added to the wiki. Link them here.
Expand Down
2 changes: 1 addition & 1 deletion vortex_auv.repos → dependencies.repos
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
repositories:
vortex_msgs:
vortex-msgs:
type: git
url: https://github.com/vortexntnu/vortex-msgs.git
1 change: 1 addition & 0 deletions docker/docker-ros
Submodule docker-ros added at 85feae
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
IMAGE="auv-image:latest" \
BASE_IMAGE="rwthika/ros2:humble" \
TARGET="dev" \
PLATFORM="linux/arm64,linux/amd64" \
./docker/docker-ros/scripts/build.sh

0 comments on commit 12787c8

Please sign in to comment.