Skip to content

🐳 Containerize WayWise and upload to DockerHub via GitHub Actions#122

Draft
Copilot wants to merge 11 commits into
mainfrom
copilot/containerize-waywise-dockerhub
Draft

🐳 Containerize WayWise and upload to DockerHub via GitHub Actions#122
Copilot wants to merge 11 commits into
mainfrom
copilot/containerize-waywise-dockerhub

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 23, 2025

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature: Docker containerization for WayWise with automated builds and publishing to DockerHub and GitHub Container Registry.

  • What is the current behavior? (You can also link to an open issue here)

WayWise requires manual local builds and has no containerization support, making it difficult to spin up clean, isolated instances quickly for experiments.

Fixes #121

  • What is the new behavior (if this is a feature change)?

This PR implements complete Docker containerization for WayWise:

Multi-stage Dockerfile

  • Optimized for C++ builds with Ubuntu 24.04 base
  • Separate MAVSDK stage with hash verification for reproducible builds
  • Runtime stage with minimal dependencies
  • All three example executables included:
    • RCCar_MAVLINK_autopilot (default)
    • RCCar_ISO22133_autopilot
    • map_local_twocars
  • Runs as non-root user waywise for enhanced security
  • Process-based healthcheck using pgrep to verify the main process is running
  • Exposes UDP ports 14540 and 14550 for MAVLINK communication

GitHub Actions Workflow

  • Automated builds triggered by pull requests and manual workflow dispatch
  • Multi-architecture support (linux/amd64, linux/arm64)
  • Docker buildx with GitHub Actions cache for faster builds
  • Ready for DockerHub and GHCR publishing (requires secrets configuration)

Documentation

  • Comprehensive DOCKER.md reference guide
  • Quick start examples in README.md
  • docker-compose.yml for easy orchestration

Key Features

  • Stateless design without persistent volumes
  • Instant reset capability by restarting container
  • Isolated, repeatable environments
  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

No breaking changes. This adds new functionality without affecting existing usage.

  • Other information:

To enable automated publishing, add these repository secrets:

  • DOCKERHUB_USERNAME: DockerHub username or organization
  • DOCKERHUB_TOKEN: DockerHub access token
Original prompt

This section details on the original issue you should resolve

<issue_title>🚢 Containerize WayWise and upload to DockerHub via GitHub Actions 🐳</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
We need a way to provide a "fresh start" and "reset" functionality for WayWise deployments, especially for experiments in the PRECISE-project that use LLM-powered Security Chaos Engineering. This requires being able to spin up clean, isolated instances of WayWise quickly, without any persistent volumes or data carried over between runs. ♻️🔄

Describe the solution you'd like

  • 🐋 Create a Dockerfile for the WayWise project to containerize the application.
  • 🤖 Set up a GitHub Actions workflow to automatically build and push the WayWise container image to DockerHub on every release or on demand.
  • 🚫 Ensure the Docker image starts cleanly and does not use persistent volumes by default.
  • 📄 Provide documentation on how to pull and run the container, including a section on resetting state by simply restarting the container.
  • 🏷️ Tag the image appropriately for PRECISE-project experiments and general usage.

Describe alternatives you've considered

  • 🛠️ Manual container builds and uploads (not scalable or repeatable).
  • 🏗️ Using non-containerized deployments (difficult to reset and automate in chaos experiments).

Additional context
This is needed for the PRECISE-project's security chaos engineering experiments, where being able to quickly "reset" the target system is essential. The lack of persistent volumes ensures each run is isolated and repeatable. ⚡

The main language of the project is C++ (98.9%), so the Dockerfile should be optimized for C++ builds and runtime. 🏎️</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #121


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits October 23, 2025 09:25
Co-authored-by: kallegrens <105279176+kallegrens@users.noreply.github.com>
- Create multi-stage Dockerfile for optimized C++ builds
- Add .dockerignore for efficient Docker builds
- Create GitHub Actions workflow for automated DockerHub pushes
- Add comprehensive Docker documentation in README and DOCKER.md
- Update .gitignore to exclude build artifacts

Co-authored-by: kallegrens <105279176+kallegrens@users.noreply.github.com>
- Add libatomic1 for ISO22133 example
- Add Qt widgets/printsupport libraries for map_local_twocars
- Create docker-compose.yml for easy container management
- Verify all three executables run successfully

Co-authored-by: kallegrens <105279176+kallegrens@users.noreply.github.com>
- Add instructions for running map_local_twocars with display
- Document both X11 forwarding and headless mode options
- Complete security check with CodeQL (no issues found)

Co-authored-by: kallegrens <105279176+kallegrens@users.noreply.github.com>
Copilot AI changed the title [WIP] Containerize WayWise and upload to DockerHub via GitHub Actions 🐳 Containerize WayWise and upload to DockerHub via GitHub Actions Oct 23, 2025
Copilot AI requested a review from kallegrens October 23, 2025 10:05
Comment thread Dockerfile Outdated
Comment thread README.md Outdated
add ghcr as container repository in addition to DockerHub.

remove references to PRECISE and Chaos Engineering from readme's. add install options into CMakeLists.txt (used for a cleaner Dockerfile)
as it is not allowed in gh actions
@kallegrens kallegrens marked this pull request as ready for review November 18, 2025 10:38
kallegrens and others added 2 commits November 18, 2025 11:58
instead use manual workflow dispatch when a new image should be built and pushed
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for now, cleaner would be to separate building and pushing into two workflows rather than guarding with if-statements. Will maybe do in a separate PR later.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Docker containerization for WayWise to enable rapid deployments and state resets for security chaos engineering experiments in the PRECISE project. The implementation provides a multi-stage Dockerfile, GitHub Actions automation for building and publishing images, and comprehensive documentation.

  • Multi-stage Dockerfile optimized for C++ builds with Ubuntu 24.04 base
  • Automated CI/CD pipeline for building and publishing to DockerHub and GitHub Container Registry
  • Complete documentation including quick start guide and troubleshooting

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Dockerfile Multi-stage build with MAVSDK installation, build dependencies, and minimal runtime image
.github/workflows/docker-ghcr-build-push.yaml GitHub Actions workflow for automated Docker image builds and publishing
docker-compose.yaml Docker Compose configuration with service definitions for three example applications
README.md Added Docker usage section with quick start guide and connection examples
DOCKER.md Comprehensive 370-line Docker reference guide with detailed usage instructions
examples/CMakeLists.txt Added install targets for the three example executables
.dockerignore Build context optimization by excluding unnecessary files
.gitignore Added exclusions for downloaded binaries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/docker-ghcr-build-push.yaml
Comment thread Dockerfile Outdated
RUN printf '#!/bin/sh\nexec /usr/local/bin/RCCar_MAVLINK_autopilot >/dev/null 2>&1 || exit 1\n' \
> /usr/local/bin/healthcheck && chmod +x /usr/local/bin/healthcheck

# RUN useradd -m -s /bin/bash waywise
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed. This line is redundant as the user is already created on line 110 with groupadd/useradd commands. Remove this commented line to keep the Dockerfile clean.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the commented-out line in commit a0edf39.

Comment thread Dockerfile Outdated
Comment on lines +114 to +115
RUN printf '#!/bin/sh\nexec /usr/local/bin/RCCar_MAVLINK_autopilot >/dev/null 2>&1 || exit 1\n' \
> /usr/local/bin/healthcheck && chmod +x /usr/local/bin/healthcheck
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The healthcheck script will always fail. The script attempts to execute the autopilot binary and redirects all output to /dev/null, expecting it to exit successfully. However, the autopilot is a long-running service that doesn't exit on its own. This will cause the healthcheck to always report unhealthy. Consider using a different health check mechanism, such as checking if the process is running with pgrep RCCar_MAVLINK_autopilot or testing the UDP port availability.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the healthcheck to use pgrep -x RCCar_MAVLINK_autopilot instead of trying to execute the binary. This checks if the process is running rather than waiting for it to exit. Commit a0edf39.

Comment thread README.md
Comment thread DOCKER.md
- Use pgrep to check if process is running instead of executing the binary
- Remove redundant commented-out useradd line (user already created on line 110)

Co-authored-by: kallegrens <105279176+kallegrens@users.noreply.github.com>
Copilot AI requested a review from kallegrens November 25, 2025 14:20
@r2avula r2avula marked this pull request as draft November 26, 2025 09:00
@r2avula
Copy link
Copy Markdown
Member

r2avula commented Nov 26, 2025

I have a hard time seeing the value of containerizing only the examples. Instead, there is value in containerizing WayWise by installing it as a proper library that can be used in other projects (like RCCar, ControlTower) directly (similar to MAVSDK) without using WayWise as a submodule. We could add a CMakeLists.txt file in the WayWise root that supports selective builds with CMake options for front-end/back-end components. This would be very useful, for example, when performing chaos experiments on applications (such as Precise-Truck).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚢 Containerize WayWise and upload to DockerHub via GitHub Actions 🐳

4 participants