-
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
Optimized dockerfile #54
Changes from 5 commits
016a367
eec2975
3fc4954
c84c294
fd3d441
f6c048b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,47 @@ | ||
FROM robotlocomotion/drake:1.29.0 | ||
LABEL maintainer="Aditya Kamireddypalli [email protected]" | ||
ARG ROS_DISTRO=rolling | ||
ARG RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | ||
ARG DRAKE_VERSION=1.30.0-1 | ||
|
||
ENV ROS_DISTRO=humble | ||
ENV WORKSPACE=/root/workspace/ | ||
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
FROM moveit/moveit2:${ROS_DISTRO}-source | ||
LABEL maintainer="Aditya Kamireddypalli [email protected]" | ||
|
||
# ROS installation | ||
RUN apt update && \ | ||
apt install locales && \ | ||
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 | ||
ARG ROS_DISTRO | ||
ARG RMW_IMPLEMENTATION | ||
ARG DRAKE_VERSION | ||
|
||
RUN apt install -y software-properties-common && \ | ||
add-apt-repository universe | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV WORKSPACE=${ROS_UNDERLAY}/.. | ||
|
||
COPY . ${WORKSPACE}/src/moveit_drake | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends \ | ||
ca-certificates \ | ||
gnupg \ | ||
lsb-release \ | ||
wget -y && \ | ||
wget -qO- https://drake-apt.csail.mit.edu/drake.asc | gpg --dearmor - \ | ||
| sudo tee /etc/apt/trusted.gpg.d/drake.gpg >/dev/null && \ | ||
echo "deb [arch=amd64] https://drake-apt.csail.mit.edu/$(lsb_release -cs) $(lsb_release -cs) main" \ | ||
| sudo tee /etc/apt/sources.list.d/drake.list >/dev/null && \ | ||
apt-get update && \ | ||
apt-get install --no-install-recommends drake-dev=${DRAKE_VERSION} -y | ||
|
||
RUN apt update && \ | ||
apt install -y curl git && \ | ||
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \ | ||
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" | tee /etc/apt/sources.list.d/ros2.list > /dev/null | ||
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ | ||
cd ${WORKSPACE}/src && \ | ||
vcs import < moveit_drake/.docker/upstream.repos --recursive | ||
|
||
RUN apt update && \ | ||
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ | ||
cd ${WORKSPACE} && \ | ||
rosdep update --rosdistro=$ROS_DISTRO && \ | ||
apt-get update && \ | ||
apt upgrade -y && \ | ||
apt install -y \ | ||
build-essential \ | ||
clang-format-14 \ | ||
clangd-12 \ | ||
cmake \ | ||
git-lfs \ | ||
python3-colcon-common-extensions \ | ||
python3-flake8 \ | ||
python3-rosdep \ | ||
python3-setuptools \ | ||
python3-vcstool \ | ||
ros-dev-tools \ | ||
ros-${ROS_DISTRO}-desktop \ | ||
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \ | ||
wget && \ | ||
update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-12 100 | ||
|
||
RUN pip3 install colcon-mixin pre-commit && \ | ||
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ | ||
colcon mixin update default | ||
|
||
RUN apt update && \ | ||
rosdep init && \ | ||
rosdep update | ||
|
||
# Setup the workspace | ||
WORKDIR ${WORKSPACE} | ||
RUN mkdir -p src | ||
|
||
# Install dependencies of this package | ||
# NOTE: Copying only the necessary files to not bust cache as much. | ||
COPY moveit_drake.repos ${WORKSPACE}/src/moveit_drake/ | ||
WORKDIR ${WORKSPACE}/src/ | ||
RUN vcs import < moveit_drake/moveit_drake.repos | ||
|
||
WORKDIR ${WORKSPACE} | ||
COPY package.xml ${WORKSPACE}/src/moveit_drake/ | ||
RUN apt update && \ | ||
. /opt/ros/${ROS_DISTRO}/setup.sh && \ | ||
rosdep install -r --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y && \ | ||
rm -rf src/moveit_drake | ||
rosdep install --from-paths src --ignore-src -r -y && \ | ||
apt-get install ros-${ROS_DISTRO}-rmw-cyclonedds-cpp -y | ||
|
||
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \ | ||
cd ${WORKSPACE} && \ | ||
. install/setup.sh && \ | ||
colcon build --mixin release --parallel-workers 1 | ||
|
||
# Set up the entrypoint | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
repositories: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There already is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually inspired from upstream.repos of moveit2_tutorials. While installing via docker, we don't need to clone repositories like moveit2 (they already installed in MoveIt's docker image) . In case of local installation, user need to clone additional repositories in addition of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this seems to be the likely way to go forward. I am in favor of keeping both for now. This gives users the option of doing a single VCS import if working locally. Could you add some instructions on README, under the local installation section to point users to this effect? May also be beneficial to specify that the build time is large in this case. |
||
moveit_visual_tools: | ||
type: git | ||
url: https://github.com/moveit/moveit_visual_tools | ||
version: ros2 | ||
rviz_visual_tools: | ||
type: git | ||
url: https://github.com/PickNikRobotics/rviz_visual_tools.git | ||
version: ros2 |
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.
I guess these are default values, maybe give it through docker compose?
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.
Overall done it with a couple of details: I couldn't build docker image without setting default argument inside dockerfile. So i just have updated docker-compose yaml instead of changing dockerfile as well. Now we can change args through compose file.