Skip to content

Commit

Permalink
Merge pull request #53 from avcuenes/ros2
Browse files Browse the repository at this point in the history
add dockerfile and makefile
  • Loading branch information
Ryanf55 authored Jan 20, 2024
2 parents 2d14e52 + ae21ad9 commit 22bfe8d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.vscode/*
html/*
build/*
install/*
log/*
LICENSE
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Use the official ROS 2 humble base image
ARG ROS_DISTRO=humble
FROM ros:${ROS_DISTRO} as deps

# Set the working directory
WORKDIR /root/ros2_ws

SHELL ["/bin/bash", "-c"]

RUN source /opt/ros/${ROS_DISTRO}/setup.bash
RUN --mount=type=bind,source=package.xml,target=src/grid_map_geo/package.xml \
apt update && \
rosdep update && \
rosdep install --from-paths src --ignore-src -y

# Run a default command, e.g., starting a bash shell
CMD ["bash"]

FROM deps as builder
ARG CMAKE_BUILD_TYPE=Release

RUN source /opt/ros/${ROS_DISTRO}/setup.bash
COPY . .
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} --packages-up-to grid_map_geo

# Source the ROS2 setup file
RUN echo "source /root/ros2_ws/install/setup.bash" >> ~/.bashrc

# Run a default command, e.g., starting a bash shell
CMD ["bash"]

7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY : docker_build
docker_build:
docker build -t gmg .

.PHONY : docker_run
docker_run:
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
4 changes: 3 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
<depend>libgdal-dev</depend>
<depend>rclcpp</depend>
<depend>yaml_cpp_vendor</depend>
<exec_depend>ros2launch</exec_depend>

<exec_depend>grid_map_rviz_plugin</exec_depend>
<exec_depend>ros2launch</exec_depend>
<exec_depend>rviz2</exec_depend>

<export>
<build_type>ament_cmake</build_type>
Expand Down

0 comments on commit 22bfe8d

Please sign in to comment.