Skip to content

Commit 93339b8

Browse files
committed
add dockerfile and makefile
1 parent c8e6f97 commit 93339b8

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Use the official ROS 2 humble base image
2+
FROM ros:humble
3+
4+
# Set the working directory
5+
WORKDIR /ros2_workspace/src
6+
7+
COPY . .
8+
# Install additional dependencies
9+
RUN apt-get update \
10+
&& apt-get -y --quiet --no-install-recommends install \
11+
gcc \
12+
git \
13+
libxml2-dev \
14+
libxslt-dev \
15+
python3 \
16+
ros-humble-ament-cmake-clang-format\
17+
ros-humble-rviz2
18+
19+
# Set environment variables
20+
ENV ROS_DISTRO humble
21+
ENV ROS_VERSION 2
22+
WORKDIR /ros2_workspace
23+
RUN . /opt/ros/humble/setup.sh
24+
RUN rosdep update
25+
RUN rosdep install --from-paths src --ignore-src -y
26+
27+
RUN . /opt/ros/humble/setup.sh && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to grid_map_geo
28+
29+
# Source the ROS2 setup file
30+
RUN echo "source /ros2_workspace/install/setup.bash" >> ~/.bashrc
31+
# Expose the default ROS 2 communication ports
32+
EXPOSE 11311
33+
34+
# Run a default command, e.g., starting a bash shell
35+
CMD ["bash"]

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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
8+
9+
10+
11+

0 commit comments

Comments
 (0)