-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
47 lines (41 loc) · 1.87 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ARG ROS_DISTRO=galactic
FROM ros:${ROS_DISTRO}-ros-base
### Use bash by default
SHELL ["/bin/bash", "-c"]
### Define working directory
ARG WS_DIR=/root/ws
ENV WS_DIR=${WS_DIR}
ENV WS_SRC_DIR=${WS_DIR}/src
ENV WS_INSTALL_DIR=${WS_DIR}/install
ENV WS_LOG_DIR=${WS_DIR}/log
WORKDIR ${WS_DIR}
### Install Gazebo
ARG IGNITION_VERSION=fortress
ENV IGNITION_VERSION=${IGNITION_VERSION}
RUN apt-get update && \
apt-get install -yq --no-install-recommends \
ignition-${IGNITION_VERSION} && \
rm -rf /var/lib/apt/lists/*
### Import and install dependencies, then build these dependencies (not ign_moveit2_examples yet)
COPY ./ign_moveit2_examples.repos ${WS_SRC_DIR}/ign_moveit2_examples/ign_moveit2_examples.repos
RUN vcs import --shallow ${WS_SRC_DIR} < ${WS_SRC_DIR}/ign_moveit2_examples/ign_moveit2_examples.repos && \
rosdep update && \
apt-get update && \
rosdep install -y -r -i --rosdistro "${ROS_DISTRO}" --from-paths ${WS_SRC_DIR} && \
rm -rf /var/lib/apt/lists/* && \
source "/opt/ros/${ROS_DISTRO}/setup.bash" && \
colcon build --merge-install --symlink-install --cmake-args "-DCMAKE_BUILD_TYPE=Release" && \
rm -rf ${WS_LOG_DIR}
### Copy over the rest of ign_moveit2_examples, then install dependencies and build
COPY ./ ${WS_SRC_DIR}/ign_moveit2_examples/
RUN rosdep update && \
apt-get update && \
rosdep install -y -r -i --rosdistro "${ROS_DISTRO}" --from-paths ${WS_SRC_DIR} && \
rm -rf /var/lib/apt/lists/* && \
source "/opt/ros/${ROS_DISTRO}/setup.bash" && \
colcon build --merge-install --symlink-install --cmake-args "-DCMAKE_BUILD_TYPE=Release" && \
rm -rf ${WS_LOG_DIR}
### Add workspace to the ROS entrypoint
### Source ROS workspace inside `~/.bashrc` to enable autocompletion
RUN sed -i '$i source "${WS_INSTALL_DIR}/local_setup.bash" --' /ros_entrypoint.sh && \
sed -i '$a source "/opt/ros/${ROS_DISTRO}/setup.bash"' ~/.bashrc