forked from CollaborativeRoboticsLab/sphero_rvr_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
109 lines (76 loc) · 3.17 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# If push fails restart docker engine on gram ('sudo service docker restart')
# Commands for rvrbot on RPi/arm64
# no-cache / registry: docker build --no-cache --target=rvrbot --file Dockerfile -t gram:5000/rvr:arm64 . --push
# cache / registry: docker build --target=rvrbot --file Dockerfile -t gram:5000/rvr:arm64 . --push
# cache / local: docker build --target=rvrbot --file Dockerfile -t rvr:arm64 . DON'T FORGET '.'
# run registry: docker run -it --rm --network=host --privileged --name=rvrbot gram:5000/rvr:arm64
# run local: docker run -it --rm --network=host --privileged --name=rvrbot rvr:arm64
# roslaunch sphero_rvr_bringup sphero_rvr_merged_bringup.launch
# docker exec -it rvrbot /bin/bash
# Commands for devhost on gram/x86:
# docker build --no-cache --target=devhost --file Dockerfile -t gram:5000/rvr:x86 . --push
# docker build --target=devhost --file Dockerfile -t gram:5000/rvr:x86 . --push
# docker run -it --rm --network=host --privileged --name=devhost gram:5000/rvr:x86
# xhost +local:
# rosrun tf2_tools view_frames.py
# evince frames.pdf
# docker exec -it devhost /bin/bash
# roslaunch sphero_rvr_navigation navigation.launch
FROM ros:noetic-ros-base-focal AS base
USER root
# Suppress all interactive prompts during build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update -y && \
# Upgrade required or 'rosdep install' gets errors pulling dependencies
apt upgrade -y && \
apt install -y \
python3-catkin-tools \
python3-vcstool \
wget \
git \
python3-pip \
# Install tools for debugging comms at runtime
net-tools \
iputils-ping \
netcat \
nano
# Set location of our container's catkin workspace
ENV ROS_WS /opt/ros_ws
RUN mkdir -p $ROS_WS/src
WORKDIR ${ROS_WS}
# COPY-from is rooted at location of this Dockerfile
COPY src $ROS_WS/src
# Clone ROS Robot Localization package
# RUN git -C src clone \
# -b noetic-devel \
# https://github.com/cra-ros-pkg/robot_localization.git
# Clone LDLIDAR package
# RUN git -C src clone \
# -b master \
# https://github.com/ldrobotSensorTeam/ldlidar_stl_ros.git
# Add the Sphero SDK and MQTT library
RUN pip install sphero-sdk
RUN pip install paho-mqtt
# Install ROS package dependencies
RUN rosdep update && \
rosdep install --from-paths src --ignore-src -r -y
# Build ROS packages from source code
RUN catkin config --extend /opt/ros/$ROS_DISTRO && \
catkin build
# Tell container that UI output goes to host X11 server
# Note: Host must execute 'xhost +local:' command BEFORE rviz starts
# Note: 'docker run --ipc=' parameter may improve some rviz rendering artifacts
ENV DISPLAY=:0
COPY ros_entrypoint.bash .
RUN chmod +x ./ros_entrypoint.bash
ENTRYPOINT ["./ros_entrypoint.bash"]
# Following executes at <exec "$@"> in entrypoint file
CMD ["/bin/bash"]
# Do not change following ENVs - they are set this way after much debugging
# Create two layers with active one selected by build --target argument
FROM base AS rvrbot
ENV ROS_MASTER_URI=http://localhost:11311/
ENV ROS_HOSTNAME=rvrbot
FROM base AS devhost
ENV ROS_MASTER_URI=http://rvrbot:11311/
ENV ROS_HOSTNAME=gram