Skip to content

Commit 22bfe8d

Browse files
authored
Merge pull request #53 from avcuenes/ros2
add dockerfile and makefile
2 parents 2d14e52 + ae21ad9 commit 22bfe8d

File tree

4 files changed

+48
-1
lines changed

4 files changed

+48
-1
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.vscode/*
2+
html/*
3+
build/*
4+
install/*
5+
log/*
6+
LICENSE

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Use the official ROS 2 humble base image
2+
ARG ROS_DISTRO=humble
3+
FROM ros:${ROS_DISTRO} as deps
4+
5+
# Set the working directory
6+
WORKDIR /root/ros2_ws
7+
8+
SHELL ["/bin/bash", "-c"]
9+
10+
RUN source /opt/ros/${ROS_DISTRO}/setup.bash
11+
RUN --mount=type=bind,source=package.xml,target=src/grid_map_geo/package.xml \
12+
apt update && \
13+
rosdep update && \
14+
rosdep install --from-paths src --ignore-src -y
15+
16+
# Run a default command, e.g., starting a bash shell
17+
CMD ["bash"]
18+
19+
FROM deps as builder
20+
ARG CMAKE_BUILD_TYPE=Release
21+
22+
RUN source /opt/ros/${ROS_DISTRO}/setup.bash
23+
COPY . .
24+
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
25+
colcon build --cmake-args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} --packages-up-to grid_map_geo
26+
27+
# Source the ROS2 setup file
28+
RUN echo "source /root/ros2_ws/install/setup.bash" >> ~/.bashrc
29+
30+
# Run a default command, e.g., starting a bash shell
31+
CMD ["bash"]
32+

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.PHONY : docker_build
2+
docker_build:
3+
docker build -t gmg .
4+
5+
.PHONY : docker_run
6+
docker_run:
7+
docker run -it --net=host --ipc=host --privileged --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="${XAUTHORITY}:/root/.Xauthority" --entrypoint /bin/bash gmg

package.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
<depend>libgdal-dev</depend>
2121
<depend>rclcpp</depend>
2222
<depend>yaml_cpp_vendor</depend>
23-
<exec_depend>ros2launch</exec_depend>
23+
2424
<exec_depend>grid_map_rviz_plugin</exec_depend>
25+
<exec_depend>ros2launch</exec_depend>
26+
<exec_depend>rviz2</exec_depend>
2527

2628
<export>
2729
<build_type>ament_cmake</build_type>

0 commit comments

Comments
 (0)