Skip to content

Commit 2affbc0

Browse files
authored
Added Dockerfile and Entrypoint Script for VisualCircuit (#378)
* added common working dockerfile * added working VCDI with RI scripts * changed for branch specific
1 parent c7266f6 commit 2affbc0

File tree

10 files changed

+722
-0
lines changed

10 files changed

+722
-0
lines changed

scripts/VCDI/Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM python:3.11-slim
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
curl \
6+
build-essential \
7+
gnupg \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
11+
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
12+
apt-get update && apt-get install -y nodejs
13+
14+
15+
WORKDIR /app
16+
17+
18+
ARG BRANCH=master
19+
20+
RUN git clone --branch ${BRANCH} --single-branch https://github.com/JdeRobot/VisualCircuit.git
21+
22+
23+
24+
WORKDIR /app/VisualCircuit/frontend
25+
RUN npm install --legacy-peer-deps
26+
27+
28+
WORKDIR /app/VisualCircuit/backend
29+
RUN pip install --upgrade pip && pip install -r requirements.txt
30+
31+
RUN echo "DJANGO_DEBUG=true" >> /app/VisualCircuit/backend/.env && \
32+
echo "VISUAL_CIRCUIT_FRONTEND_HOST='http://localhost:4000'" >> /app/VisualCircuit/backend/.env && \
33+
echo "DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1" >> /app/VisualCircuit/backend/.env && \
34+
echo "DJANGO_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> /app/VisualCircuit/backend/.env
35+
36+
# Collect static files
37+
RUN python manage.py collectstatic
38+
39+
WORKDIR /app/VisualCircuit
40+
COPY entrypoint.sh /entrypoint.sh
41+
RUN chmod +x /entrypoint.sh
42+
43+
EXPOSE 4000 8080
44+
ENTRYPOINT ["/entrypoint.sh"]
45+

scripts/VCDI/entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "Starting backend server on port 8080..."
5+
cd /app/VisualCircuit/backend
6+
python3 manage.py migrate || true
7+
python3 manage.py runserver 0.0.0.0:8080 &
8+
9+
echo "Starting frontend server on port 4000..."
10+
cd /app/VisualCircuit/frontend
11+
npm start
Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu22.04
2+
3+
# Make all NVIDIA GPUS visible
4+
ARG NVIDIA_VISIBLE_DEVICES=all
5+
ENV NVIDIA_DRIVER_CAPABILITIES=all
6+
ENV VIRTUALGL_VERSION=3.0.2
7+
ENV TURBOVNC_VERSION=3.0.3
8+
9+
# Setup NON INTERACTIVE ENVIRONMENT
10+
ENV DEBIAN_FRONTEND=noninteractive
11+
12+
# Install locales to prevent errors
13+
RUN apt-get clean && \
14+
apt-get update && \
15+
apt-get install --no-install-recommends -y locales && \
16+
rm -rf /var/lib/apt/lists/* && \
17+
locale-gen en_US.UTF-8
18+
ENV LANG=en_US.UTF-8
19+
ENV LANGUAGE=en_US:en
20+
ENV LC_ALL=en_US.UTF-8
21+
22+
ENV ROS_DISTRO=humble
23+
ENV AMENT_PREFIX_PATH=/opt/ros/${ROS_DISTRO}
24+
ENV COLCON_PREFIX_PATH=/opt/ros/${ROS_DISTRO}
25+
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/${ROS_DISTRO}/opt/rviz_ogre_vendor/lib:/opt/ros/${ROS_DISTRO}/lib/x86_64-linux-gnu:/opt/ros/${ROS_DISTRO}/lib:/usr/share/gazebo/../../lib/x86_64-linux-gnu/gazebo-11/plugins:
26+
ENV PATH=/opt/ros/${ROS_DISTRO}/bin:$PATH
27+
ENV PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python3.10/site-packages
28+
ENV ROS_PYTHON_VERSION=3
29+
ENV ROS_VERSION=2
30+
31+
# Install common tools
32+
RUN apt-get update && apt-get install -y \
33+
software-properties-common \
34+
bash-completion \
35+
apt-utils \
36+
build-essential \
37+
git curl wget cmake \
38+
nano vim \
39+
gnupg \
40+
lsb-release \
41+
sudo \
42+
net-tools \
43+
pciutils \
44+
&& rm -rf /var/lib/apt/lists/*
45+
46+
# Install ROS2 and ROS packages
47+
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
48+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \
49+
&& apt-get update && apt-get install -y \
50+
ros-${ROS_DISTRO}-ros-base \
51+
ros-${ROS_DISTRO}-xacro \
52+
ros-${ROS_DISTRO}-joint-state-publisher \
53+
ros-${ROS_DISTRO}-rviz2 \
54+
python3-colcon-common-extensions \
55+
python3-pip python3-rosdep python3-vcstool \
56+
python3-argcomplete \
57+
&& rosdep init \
58+
&& rm -rf /var/lib/apt/lists/*
59+
60+
# Install Gazebo 11
61+
RUN add-apt-repository ppa:openrobotics/gazebo11-gz-cli
62+
RUN apt-get update && apt-get install -y \
63+
gazebo11 \
64+
ros-humble-gazebo-ros-pkgs \
65+
gstreamer1.0-plugins-bad \
66+
gstreamer1.0-plugins-good \
67+
gstreamer1.0-plugins-ugly \
68+
gstreamer1.0-libav \
69+
libgstreamer-plugins-base1.0-dev \
70+
libimage-exiftool-perl \
71+
&& apt-get -y autoremove \
72+
&& apt-get clean autoclean \
73+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
74+
RUN mkdir ~/.gazebo && touch ~/.gazebo/gui.ini
75+
76+
# Install Gazebo Harmonic
77+
RUN apt-get update \
78+
&& wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
79+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
80+
&& apt-get update && apt-get install -y -q \
81+
gz-harmonic \
82+
&& rm -rf /var/lib/apt/lists/*
83+
84+
RUN apt-get update && apt-get install -y \
85+
ros-humble-ros-gzharmonic \
86+
&& rm -rf /var/lib/apt/lists/*
87+
88+
# Install VNC
89+
# Xorg segfault error mitigation
90+
RUN apt-get update && apt-get install -y --no-install-recommends \
91+
dbus-x11 \
92+
libdbus-c++-1-0v5 \
93+
xvfb xauth xfonts-base xkb-data x11-xkb-utils \
94+
x11vnc \
95+
xterm \
96+
xserver-xorg-video-dummy \
97+
x11-apps \
98+
&& apt-get -y autoremove \
99+
&& apt-get clean autoclean \
100+
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
101+
102+
RUN wget https://xpra.org/xorg.conf \
103+
&& rm -rf /tmp/*
104+
105+
# Install noVNC and websockify
106+
RUN git clone -b v1.4.0 https://github.com/novnc/noVNC.git
107+
RUN cd /noVNC/utils && git clone -b v0.11.0 https://github.com/novnc/websockify.git
108+
109+
# VirtualGL and TurboVNC
110+
COPY ./gpu/virtualgl_${VIRTUALGL_VERSION}_amd64.deb ./gpu/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb ./gpu/turbovnc_${TURBOVNC_VERSION}_amd64.deb /
111+
112+
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y \
113+
libxtst6:i386 \
114+
libxv1:i386 \
115+
libglu1-mesa:i386 \
116+
libegl1-mesa:i386 \
117+
libegl1-mesa:amd64
118+
119+
RUN apt-get update && dpkg -i /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtualgl32_${VIRTUALGL_VERSION}_amd64.deb \
120+
&& rm /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtualgl32_${VIRTUALGL_VERSION}_amd64.deb \
121+
&& chmod u+s /usr/lib/libvglfaker.so \
122+
&& chmod u+s /usr/lib/libdlfaker.so \
123+
&& chmod u+s /usr/lib32/libvglfaker.so \
124+
&& chmod u+s /usr/lib32/libdlfaker.so \
125+
&& chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so \
126+
&& chmod u+s /usr/lib/i386-linux-gnu/libdlfaker.so \
127+
&& apt-get update && apt-get install -y --no-install-recommends \
128+
/turbovnc_${TURBOVNC_VERSION}_amd64.deb \
129+
&& rm turbovnc_${TURBOVNC_VERSION}_amd64.deb \
130+
&& rm -rf /var/lib/apt/lists/*
131+
132+
RUN apt-get update && \
133+
apt-get install -y lxde-common && \
134+
rm -rf /var/lib/apt/lists/*
135+
136+
ENV PATH="$PATH:/opt/VirtualGL/bin:/opt/TurboVNC/bin"
137+
138+
# Node
139+
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \
140+
&& apt-get install -y nodejs \
141+
&& npm install -g yarn
142+
143+
# Install Python 3 pip build dependencies first
144+
RUN python3.10 -m pip install --upgrade pip==23.3.1 wheel==0.41.3 setuptools==69.0.2 selenium
145+
146+
# pip install dependencies
147+
RUN python3.10 -m pip install \
148+
pylint==3.3.1 transitions==0.9.0 pydantic==2.4.2 websocket-client==1.5.2 \
149+
argparse==1.4.0 coverage==6.2 cerberus==1.3.4 empy==3.3.4 jinja2==3.0.3 kconfiglib==14.1.0 \
150+
matplotlib==3.0.* numpy==1.24.3 nunavut==1.1.0 packaging==21.3 pkgconfig==1.5.5 pyros-genmsg==0.5.8 \
151+
pyulog==1.0.1 pyyaml==5.4.1 requests==2.31.0 serial==0.0.97 six==1.16.0 toml==0.10.2 psutil==5.9.0 \
152+
onnxruntime==1.15.0 Pillow==9.0.1 opencv-python==4.5.5.64 netron seaborn==0.11.2 watchdog==2.1.5 utm==0.7.0 psycopg2 jedi pyapriltags
153+
154+
# monaco editor
155+
RUN python3.10 -m pip install black==24.10.0
156+
157+
# websocket server dependency
158+
RUN python3.10 -m pip install websocket_server==0.6.4 posix-ipc==1.1.1 django==4.1.7 djangorestframework==3.13.1 \
159+
django-webpack-loader==1.5.0 django-cors-headers==3.14.0 websockets==11.0.3 asyncio==3.4.3
160+
161+
162+
## Aerostack2
163+
WORKDIR /root/
164+
165+
RUN apt-get update && \
166+
apt-get install apt-utils -y \
167+
software-properties-common \
168+
git \
169+
tmux \
170+
tmuxinator \
171+
python3-rosdep \
172+
python3-pip \
173+
python3-colcon-common-extensions \
174+
python3-colcon-mixin \
175+
python-is-python3 \
176+
ros-dev-tools \
177+
python3-flake8 \
178+
python3-flake8-builtins \
179+
python3-flake8-comprehensions \
180+
python3-flake8-docstrings \
181+
python3-flake8-import-order \
182+
python3-flake8-quotes \
183+
cppcheck \
184+
lcov \
185+
lsb-release \
186+
wget \
187+
gnupg \
188+
&& rm -rf /var/lib/apt/lists/*
189+
190+
RUN pip3 install \
191+
pylint \
192+
flake8==4.0.1 \
193+
pycodestyle==2.8 \
194+
cmakelint \
195+
cpplint \
196+
colcon-lcov-result \
197+
PySimpleGUI-4-foss
198+
199+
RUN colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
200+
RUN colcon mixin update default
201+
RUN rm -rf log
202+
# remove log folder
203+
RUN mkdir -p /home/drones_ws/src/
204+
WORKDIR /home/drones_ws/src/
205+
RUN git clone https://github.com/aerostack2/aerostack2.git -b robotics-academy-fix
206+
RUN touch aerostack2/as2_hardware_drivers/COLCON_IGNORE
207+
RUN touch aerostack2/as2_behavior_tree/COLCON_IGNORE
208+
RUN touch aerostack2/as2_map_server/COLCON_IGNORE
209+
RUN touch aerostack2/as2_behaviors/as2_behaviors_path_planning/COLCON_IGNORE
210+
RUN touch aerostack2/as2_utilities/as2_geozones/COLCON_IGNORE
211+
RUN touch aerostack2/as2_user_interfaces/as2_visualization/as2_rviz_plugins/COLCON_IGNORE
212+
213+
WORKDIR /home/drones_ws/
214+
215+
RUN apt-get update && \
216+
apt-get install -y \
217+
libbenchmark-dev \
218+
libeigen3-dev \
219+
libgeographic-dev \
220+
libncurses-dev \
221+
libyaml-cpp-dev \
222+
pybind11-dev \
223+
python3-jinja2 \
224+
python3-pydantic \
225+
python3-pymap3d \
226+
python3-pytest \
227+
ros-humble-action-msgs \
228+
ros-humble-ament-cmake \
229+
ros-humble-ament-cmake-gtest \
230+
ros-humble-ament-cmake-lint-cmake \
231+
ros-humble-ament-cmake-pytest \
232+
ros-humble-ament-cmake-python \
233+
ros-humble-ament-cmake-xmllint \
234+
ros-humble-ament-copyright \
235+
ros-humble-ament-flake8 \
236+
ros-humble-ament-index-cpp \
237+
ros-humble-ament-lint-auto \
238+
ros-humble-ament-lint-common \
239+
ros-humble-ament-pep257 \
240+
ros-humble-backward-ros \
241+
ros-humble-builtin-interfaces \
242+
ros-humble-cv-bridge \
243+
ros-humble-geographic-msgs \
244+
ros-humble-geometry-msgs \
245+
ros-humble-image-transport \
246+
ros-humble-mocap4r2-msgs \
247+
ros-humble-nav-msgs \
248+
ros-humble-pluginlib \
249+
ros-humble-rclcpp \
250+
ros-humble-rclcpp-action \
251+
ros-humble-rclcpp-components \
252+
ros-humble-rclcpp-lifecycle \
253+
ros-humble-rclpy \
254+
ros-humble-robot-state-publisher \
255+
ros-humble-rosidl-default-generators \
256+
ros-humble-rosidl-default-runtime \
257+
ros-humble-rviz2 \
258+
ros-humble-sdformat-urdf \
259+
ros-humble-sensor-msgs \
260+
ros-humble-std-msgs \
261+
ros-humble-std-srvs \
262+
ros-humble-tf2 \
263+
ros-humble-tf2-geometry-msgs \
264+
ros-humble-tf2-msgs \
265+
ros-humble-tf2-ros \
266+
ros-humble-trajectory-msgs \
267+
ros-humble-visualization-msgs \
268+
ros-humble-moveit \
269+
ros-humble-ros2-control \
270+
ros-humble-ros2-controllers \
271+
ros-humble-gripper-controllers \
272+
ros-humble-rmw-cyclonedds-cpp \
273+
ros-humble-ur \
274+
ros-humble-ros-testing \
275+
libpoco-dev \
276+
&& rm -rf /var/lib/apt/lists/*
277+
278+
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
279+
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
280+
281+
# Install CycloneDDS RMW for ROS 2 Humble to fix cycle time issues in humble-moveit (temporary fix)
282+
RUN echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> ~/.bashrc
283+
284+
# Instalation for industrial robots
285+
286+
RUN mkdir -p /home/industrial_ws/src/ABBDriver
287+
WORKDIR /home/industrial_ws/src/ABBDriver
288+
RUN git clone https://github.com/PickNikRobotics/abb_ros2.git -b rolling
289+
RUN . /opt/ros/$ROS_DISTRO/setup.sh && rosdep update
290+
RUN vcs import < abb_ros2/abb.repos
291+
RUN . /opt/ros/$ROS_DISTRO/setup.sh && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
292+
WORKDIR /home/industrial_ws/src
293+
RUN git clone https://github.com/ros-controls/gazebo_ros2_control.git
294+
RUN cd gazebo_ros2_control && git reset --hard 9a3736c # Commit for the 0.4.6 version!
295+
RUN git clone https://github.com/IFRA-Cranfield/IFRA_LinkAttacher.git
296+
RUN git clone https://github.com/IFRA-Cranfield/IFRA_ObjectPose.git
297+
RUN git clone https://github.com/IFRA-Cranfield/IFRA_LinkPose.git
298+
RUN git clone https://github.com/IFRA-Cranfield/ros2_RobotiqGripper.git
299+
# Forked needed in order to read the parameters from main launcher
300+
RUN git clone https://github.com/javizqh/ros2_SimRealRobotControl
301+
RUN sudo cp /home/industrial_ws/src/ros2_SimRealRobotControl/include/move_group_interface_improved.h /opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h
302+
WORKDIR /home/industrial_ws
303+
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
304+
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
305+
306+
# Create workspace and add drone packages
307+
RUN echo "source /usr/share/gazebo/setup.bash" >> ~/.bashrc
308+
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc
309+
RUN echo 'export AEROSTACK2_PATH=/home/drones_ws/src/aerostack2' >> ~/.bashrc
310+
RUN echo 'source $AEROSTACK2_PATH/as2_cli/setup_env.bash' >> ~/.bashrc
311+
RUN echo "source /home/drones_ws/install/setup.bash" >> ~/.bashrc
312+
RUN echo "source /home/industrial_ws/install/setup.bash" >> ~/.bashrc
313+
314+
# Download and install OMPL library
315+
COPY install-ompl-ubuntu.sh /
316+
WORKDIR /
317+
RUN chmod u+x install-ompl-ubuntu.sh
318+
RUN ./install-ompl-ubuntu.sh --github --python

0 commit comments

Comments
 (0)