-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from j3soon/refactor/unify-workspace-style
Unify workspace style
- Loading branch information
Showing
79 changed files
with
1,472 additions
and
590 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
# Visual Studio Code | ||
.vscode | ||
|
||
# ROS2 basic directories | ||
/build | ||
/install | ||
/log | ||
docker/cache/* | ||
!docker/cache/.gazebo | ||
docker/cache/.gazebo/* | ||
!docker/cache/.gazebo/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
# Source global ROS2 environment | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
# Optionally perform apt update if it has not been executed yet | ||
if [ -z "$( ls -A '/var/lib/apt/lists' )" ]; then | ||
echo "apt-get update has not been executed yet. Running sudo apt-get update..." | ||
sudo apt-get update | ||
fi | ||
# Optionally perform rosdep update if it has not been executed yet | ||
if [ ! -d $HOME/.ros/rosdep/sources.cache ]; then | ||
echo "rosdep update has not been executed yet. Running rosdep update..." | ||
rosdep update | ||
fi | ||
# Optionally build the workspace if it has not been built yet | ||
if [ ! -f $ROS2_WS/install/setup.bash ]; then | ||
echo "Workspace has not been built yet. Building workspace..." | ||
cd $ROS2_WS | ||
# Ref: https://docs.ros.org/en/humble/Tutorials/Intermediate/Rosdep.html | ||
rosdep install --from-paths src --ignore-src -y -r | ||
# TODO: If command `arch` outputs `aarch64`, consider adding `--packages-ignore <package>` to ignore x86 packages | ||
# Ref: https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html | ||
if [ $(arch) == "aarch64" ]; then | ||
colcon build --symlink-install | ||
else | ||
colcon build --symlink-install | ||
fi | ||
echo "Workspace built." | ||
fi | ||
# TODO: Source other workspace environments as underlay | ||
# Source workspace environment | ||
# Note: If you have not built your workspace yet, the following command will fail | ||
source $ROS2_WS/install/setup.bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,103 @@ | ||
# Base Image : https://hub.docker.com/r/osrf/ros/tags?page=1&name=humble | ||
FROM osrf/ros:humble-desktop-full | ||
# Base Image: https://hub.docker.com/r/osrf/ros/tags?page=1&name=humble | ||
FROM osrf/ros:humble-desktop-full AS amd64 | ||
# Base Image: https://hub.docker.com/r/arm64v8/ros/tags?page=1&name=humble | ||
FROM arm64v8/ros:humble AS arm64 | ||
|
||
# Use docker automatic platform args to select the base image. | ||
# It may be `arm64` or `amd64` depending on the platform. | ||
# Ref: https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope | ||
FROM $TARGETARCH | ||
ARG TARGETARCH | ||
|
||
LABEL org.opencontainers.image.authors="assume0701@gmail.com" | ||
|
||
# Arguments for the default user | ||
ARG USERNAME=user | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
|
||
# Create the user | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
# | ||
# [Optional] Add sudo support. Omit if you don't need to install software after connecting. | ||
&& apt-get update \ | ||
&& apt-get install -y sudo \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update && apt-get upgrade -y \ | ||
|
||
# Keep downloaded packages for caching purposes | ||
# Ref: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#example-cache-apt-packages | ||
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache | ||
|
||
# Upgrade packages | ||
# Ref: https://pythonspeed.com/articles/security-updates-in-docker/ | ||
# Ref: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/reference.md#example-cache-apt-packages | ||
# Ref: https://github.com/moby/buildkit/issues/1673#issuecomment-1264502398 | ||
# Ref: https://github.com/moby/buildkit/issues/1673#issuecomment-1987107404 | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get upgrade -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN apt-get update && apt-get install -y python3-pip \ | ||
|
||
# Install sudo and create a user with sudo privileges | ||
# Ref: https://stackoverflow.com/a/65434659 | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get install -y sudo \ | ||
&& useradd -m -s /bin/bash -u $USER_UID -G sudo $USERNAME \ | ||
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ENV SHELL /bin/bash | ||
|
||
# Install common tools | ||
RUN apt-get update && apt-get install -y \ | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get install -y \ | ||
curl \ | ||
git \ | ||
git-extras \ | ||
htop \ | ||
iputils-ping \ | ||
nano \ | ||
net-tools \ | ||
tmux \ | ||
tree \ | ||
unzip \ | ||
vim \ | ||
wget \ | ||
zip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Python pip | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get install -y \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install turtlebot3, RVIZ, Gazebo and Cartographer | ||
RUN apt-get update && apt-get install -y \ | ||
ros-$ROS_DISTRO-gazebo-ros-pkgs \ | ||
# Install custom tools | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get install -y \ | ||
git-extras \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install ROS2 Gazebo packages for amd64 | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
if [ "$TARGETARCH" = "amd64" ]; then \ | ||
apt-get update && apt-get install -y \ | ||
ros-$ROS_DISTRO-gazebo-ros-pkgs \ | ||
ros-$ROS_DISTRO-gazebo-ros2-control \ | ||
&& rm -rf /var/lib/apt/lists/*; \ | ||
fi | ||
|
||
# Install ROS2 RVIZ and other custom ROS2 packages | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get install -y \ | ||
ros-$ROS_DISTRO-rviz2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# TODO: Add more commands here | ||
# For example, to install additional packages, uncomment the following lines and add the package names | ||
# RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
# apt-get update && apt-get install -y \ | ||
# $OTHER_PACKAGES \ | ||
# && rm -rf /var/lib/apt/lists/* | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ | ||
apt-get update && apt-get install -y \ | ||
ros-$ROS_DISTRO-cartographer \ | ||
ros-$ROS_DISTRO-turtlebot3* \ | ||
ros-$ROS_DISTRO-rqt-robot-steering \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY .bashrc /home/$USERNAME/.bashrc | ||
|
||
USER $USERNAME | ||
# Create Gazebo cache directory with correct ownership to avoid permission issues after volume mount | ||
RUN mkdir /home/$USERNAME/.gazebo | ||
# TODO: Run additional commands as non-root user here | ||
COPY .bashrc /home/$USERNAME/.bashrc | ||
# TODO: Copy additional files here | ||
ENTRYPOINT [] | ||
CMD ["/bin/bash"] |
Empty file.
Oops, something went wrong.