-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
206 lines (187 loc) · 7.7 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
ARG UBUNTU_RELEASE=focal
FROM ubuntu:${UBUNTU_RELEASE}
ARG UBUNTU_RELEASE
# prevent interactive prompts during build
ENV DEBIAN_FRONTEND noninteractive
# project settings
ENV PROJECT_ROOT $HOME/src/lg_ros_nodes
ENV ROS_DISTRO noetic
# Env for nvidia-docker2/nvidia container runtime
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
# entrypoint for ROS setup.bash
COPY scripts/docker_entrypoint.sh /ros_entrypoint.sh
RUN chmod 0755 /ros_entrypoint.sh
ENTRYPOINT ["/ros_entrypoint.sh"]
# pre-install some tools for installing further dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
gnupg \
wget \
&& rm -rf /var/lib/apt/lists/*
# install system dependencies and tools not tracked in rosdep
RUN \
echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list && \
wget --no-check-certificate -q -O /tmp/key.asc https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc && apt-key add /tmp/key.asc && rm /tmp/key.asc && \
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \
wget --no-check-certificate -q -O /tmp/key.pub https://dl-ssl.google.com/linux/linux_signing_key.pub && apt-key add /tmp/key.pub && rm /tmp/key.pub && \
apt-key update && \
apt-get update && \
apt-get install -y --no-install-recommends \
automake autoconf libtool \
g++ pycodestyle cppcheck \
python3-pytest wget \
python3-gst-1.0 \
python3-pip \
python3-rosdep \
python3-setuptools \
python3-rosdep \
python3-pip \
python3-setuptools \
python3-defusedxml \
python3-nose \
python3-pil \
python3-pytest \
python3-netifaces \
python3-serial \
python3-tornado \
git sudo \
curl tmux git \
xvfb x11-apps \
x-window-system binutils \
pulseaudio \
mesa-utils mesa-utils-extra \
gdebi-core \
libxext-dev \
lsb-core tar libfreeimage3 \
openssh-client \
ros-$ROS_DISTRO-rosapi libudev-dev \
ros-$ROS_DISTRO-ros-base ros-$ROS_DISTRO-rosbridge-server ros-$ROS_DISTRO-web-video-server \
ros-$ROS_DISTRO-spacenav-node spacenavd \
google-chrome-stable google-chrome-beta google-chrome-unstable \
awesome xdg-utils \
gstreamer1.0-alsa \
&& rm -rf /var/lib/apt/lists/*
# Install NodeJS and test dependencies
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g eslint \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir coveralls \
&& pip3 install --no-cache-dir \
wheel \
rospkg \
catkin_pkg \
evdev \
bson \
pyinotify \
catkin_tools \
empy \
pycrypto \
pycryptodome \
pymongo \
gnupg
# Install GE
ENV GOOGLE_EARTH_VERSION ec_7.3.0.3832_64
ENV EARTH_PKG_URL https://roscoe-assets.visionport.com:443/google-earth/google-earth-stable_${GOOGLE_EARTH_VERSION}.deb
RUN mkdir -p /tmp/GE \
&& cd /tmp/GE \
&& wget $EARTH_PKG_URL \
&& dpkg -i $( basename $EARTH_PKG_URL ) \
&& rm $( basename $EARTH_PKG_URL ) \
&& if [ -f "/opt/google/earth/free/libfreebl3.so" ]; then sed -i "s_/etc/passwd_/not/anywhr_g" "/opt/google/earth/free/libfreebl3.so"; fi
# add non-root user for tests and production
ENV RUN_USER lg
ENV HOME /home/${RUN_USER}
RUN \
useradd -ms /bin/bash $RUN_USER && \
usermod -a -G sudo,plugdev,audio,video $RUN_USER && \
mkdir -p $HOME/src ;\
echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /root/.bash_profile ;\
echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> $HOME/.bash_profile ;\
mv /bin/sh /bin/sh.bak && ln -s /bin/bash /bin/sh && \
mkdir -p $PROJECT_ROOT/src
COPY ros_entrypoint.sh ${PROJECT_ROOT}
# clone appctl
# TODO change to latest tag
ARG APPCTL_TAG=3.1.0
RUN git clone --branch ${APPCTL_TAG} https://github.com/EndPointCorp/appctl.git /appctl
RUN ln -snf /appctl/appctl ${PROJECT_ROOT}/
RUN ln -snf /appctl/appctl_msg_defs ${PROJECT_ROOT}/
# clone command_handler
RUN git clone https://github.com/EndPointCorp/command_handler.git /command_handler
RUN ln -snf /command_handler ${PROJECT_ROOT}/
# pre-install dependencies for each package
COPY interactivespaces_msgs/package.xml ${PROJECT_ROOT}/interactivespaces_msgs/package.xml
COPY lg_activity/package.xml ${PROJECT_ROOT}/lg_activity/package.xml
COPY lg_attract_loop/package.xml ${PROJECT_ROOT}/lg_attract_loop/package.xml
COPY lg_builder/package.xml ${PROJECT_ROOT}/lg_builder/package.xml
COPY lg_common/package.xml ${PROJECT_ROOT}/lg_common/package.xml
COPY lg_earth/package.xml ${PROJECT_ROOT}/lg_earth/package.xml
COPY lg_json_config/package.xml ${PROJECT_ROOT}/lg_json_config/package.xml
COPY lg_keyboard/package.xml ${PROJECT_ROOT}/lg_keyboard/package.xml
COPY lg_media/package.xml ${PROJECT_ROOT}/lg_media/package.xml
COPY lg_mirror/package.xml ${PROJECT_ROOT}/lg_mirror/package.xml
COPY lg_msg_defs/package.xml ${PROJECT_ROOT}/lg_msg_defs/package.xml
COPY lg_nav_to_device/package.xml ${PROJECT_ROOT}/lg_nav_to_device/package.xml
COPY lg_lock/package.xml ${PROJECT_ROOT}/lg_lock/package.xml
COPY lg_navlib/package.xml ${PROJECT_ROOT}/lg_navlib/package.xml
COPY lg_offliner/package.xml ${PROJECT_ROOT}/lg_offliner/package.xml
COPY lg_panovideo/package.xml ${PROJECT_ROOT}/lg_panovideo/package.xml
COPY lg_pointer/package.xml ${PROJECT_ROOT}/lg_pointer/package.xml
COPY lg_proximity/package.xml ${PROJECT_ROOT}/lg_proximity/package.xml
COPY lg_replay/package.xml ${PROJECT_ROOT}/lg_replay/package.xml
COPY lg_rfreceiver/package.xml ${PROJECT_ROOT}/lg_rfreceiver/package.xml
COPY lg_screenshot/package.xml ${PROJECT_ROOT}/lg_screenshot/package.xml
COPY lg_spacenav_globe/package.xml ${PROJECT_ROOT}/lg_spacenav_globe/package.xml
COPY lg_stats/package.xml ${PROJECT_ROOT}/lg_stats/package.xml
COPY lg_sv/package.xml ${PROJECT_ROOT}/lg_sv/package.xml
COPY lg_twister/package.xml ${PROJECT_ROOT}/lg_twister/package.xml
COPY lg_volume_control/package.xml ${PROJECT_ROOT}/lg_volume_control/package.xml
COPY lg_wireless_devices/package.xml ${PROJECT_ROOT}/lg_wireless_devices/package.xml
COPY liquidgalaxy/package.xml ${PROJECT_ROOT}/liquidgalaxy/package.xml
COPY rfid_scanner/package.xml ${PROJECT_ROOT}/rfid_scanner/package.xml
COPY rfreceiver/package.xml ${PROJECT_ROOT}/rfreceiver/package.xml
COPY spacenav_remote/package.xml ${PROJECT_ROOT}/spacenav_remote/package.xml
COPY spacenav_wrapper/package.xml ${PROJECT_ROOT}/spacenav_wrapper/package.xml
COPY state_proxy/package.xml ${PROJECT_ROOT}/state_proxy/package.xml
COPY wiimote/package.xml ${PROJECT_ROOT}/wiimote/package.xml
RUN \
apt-get update && \
apt-get install -y \
python3-gst-1.0 \
socat \
python3-debian
RUN \
source /opt/ros/$ROS_DISTRO/setup.bash && \
apt-get update && \
rosdep init && \
rosdep update --include-eol-distros && \
rosdep install \
--from-paths $PROJECT_ROOT \
--ignore-src \
--rosdistro $ROS_DISTRO \
-y && \
rm -rf /var/lib/apt/lists/*
# install the full package contents
COPY ./ ${PROJECT_ROOT}
RUN \
cd ${PROJECT_ROOT} && \
source /opt/ros/$ROS_DISTRO/setup.bash && \
/ros_entrypoint.sh ./scripts/init_workspace && \
cd ${PROJECT_ROOT}/catkin/ && \
catkin_make && \
catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/$ROS_DISTRO install && \
source $PROJECT_ROOT/catkin/devel/setup.bash && \
chown -R ${RUN_USER}:${RUN_USER} ${PROJECT_ROOT} && \
chown -R ${RUN_USER}:${RUN_USER} ${HOME}
USER $RUN_USER
# by default let's run tests
#CMD cd ${PROJECT_ROOT}/catkin && \
# . devel/setup.sh && \
# cd ${PROJECT_ROOT} && \
# ./scripts/docker_xvfb_add.sh && \
# ./scripts/test_runner.py