-
Notifications
You must be signed in to change notification settings - Fork 0
Dockerize repo #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Dockerize repo #29
Conversation
…og to gitignore for ros2 building (cherry picked from commit 8e12da2)
(cherry picked from commit 8f178c9)
(cherry picked from commit 7443658)
(cherry picked from commit e4d9c5e)
(cherry picked from commit f0e2392)
(cherry picked from commit 8232a57)
…y script (cherry picked from commit 4e5e0fb)
(cherry picked from commit 750c6fa)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
=======================================
Coverage 57.81% 57.81%
=======================================
Files 5 5
Lines 64 64
=======================================
Hits 37 37
Misses 27 27 🚀 New features to boost your workflow:
|
There was a problem hiding this 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 adds comprehensive Docker support for the ROS 2 image segmentation project, enabling containerized development and deployment with both standard Docker and VS Code devcontainer workflows.
- Adds Dockerfile based on
ros:humblewith all required ROS and Python dependencies - Provides build and run scripts for simplified Docker container management
- Configures VS Code devcontainer for integrated development environment
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
docker/Dockerfile |
Multi-stage Docker image definition with ROS 2 Humble base, system dependencies, Python packages, and non-root user setup |
docker/build.sh |
Build script with platform detection (arm64/amd64) and buildx integration for creating the Docker image |
docker/run.sh |
Run script that launches the container with host networking, privilege mode, and workspace volume mounting |
scripts/bashrc_extra.sh |
Bash startup script that sources ROS 2 underlay and workspace overlay when entering the container |
.devcontainer/devcontainer.json |
VS Code devcontainer configuration with extension recommendations and container runtime arguments |
.gitignore |
Excludes ROS 2 build artifacts (install/, build/, log/) from version control |
.dockerignore |
Excludes build artifacts, VCS files, and development tools from Docker build context |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # ---------------------------------------------------------------------------- | ||
| # Copy Workspace Files | ||
| # ---------------------------------------------------------------------------- | ||
| COPY . ${WORKSPACE} |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workspace is owned by root (COPY is executed as root user) but later switched to a non-root user. This will cause permission issues when the non-root user tries to write to the workspace. Consider changing ownership of the workspace after copying: RUN chown -R ${USER_ID}:${GROUP_ID} ${WORKSPACE}
docker/Dockerfile
Outdated
| RUN groupadd --gid ${GROUP_ID} ${USERNAME} || true && \ | ||
| useradd --uid ${USER_ID} --gid ${GROUP_ID} -m -s /bin/bash ${USERNAME} || true && \ |
Copilot
AI
Nov 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The groupadd and useradd commands use || true to suppress errors if the user/group already exists, but this silently ignores all errors including genuine failures. Consider using more specific error handling or checking if the user exists first.
| RUN groupadd --gid ${GROUP_ID} ${USERNAME} || true && \ | |
| useradd --uid ${USER_ID} --gid ${GROUP_ID} -m -s /bin/bash ${USERNAME} || true && \ | |
| RUN if ! getent group ${USERNAME} >/dev/null; then groupadd --gid ${GROUP_ID} ${USERNAME}; fi && \ | |
| if ! id -u ${USERNAME} >/dev/null 2>&1; then useradd --uid ${USER_ID} --gid ${GROUP_ID} -m -s /bin/bash ${USERNAME}; fi && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoring this. removing "|| true" creates problems for mac users (and possibly windows), as it uses different ids automatically assigned.
- Reorder Dockerfile to create the non-root user before copying source code. - Add `chown` to workspace files to ensure the non-root user has write access. - Remove redundant `--user` flag in run.sh to rely on the image's configured user.
for more information, see https://pre-commit.ci
No issue created
Changes