-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
71 lines (52 loc) · 2.78 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
ARG ROS_DISTRO=humble
ARG PREFIX=
FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base AS package-builder
ARG PREFIX
# https://github.com/cyberbotics/webots/tags
ARG WEBOTS_RELEASE_NAME=R2024a
RUN cd / && apt-get update && apt-get install --yes wget && rm -rf /var/lib/apt/lists/ && \
wget https://github.com/cyberbotics/webots/releases/download/nightly_8_8_2023/webots-$WEBOTS_RELEASE_NAME-x86-64.tar.bz2 && \
tar xjf webots-*.tar.bz2 && rm webots-*.tar.bz2
RUN apt-get update -y && apt-get install -y git python3-colcon-common-extensions python3-vcstool python3-rosdep curl
WORKDIR /ros2_ws
RUN cd /ros2_ws && \
git clone https://github.com/husarion/webots_ros2.git src/webots_ros2 -b 2024a && \
cd src/webots_ros2 && \
git submodule update --init
SHELL ["/bin/bash", "-c"]
RUN MYDISTRO=${PREFIX:-ros}; MYDISTRO=${MYDISTRO//-/} && \
source /opt/$MYDISTRO/$ROS_DISTRO/setup.bash && \
# without this line (using vulcanexus base image) rosdep init throws error: "ERROR: default sources list file already exists:"
rm -rf /etc/ros/rosdep/sources.list.d/20-default.list && \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install --ignore-src --from-path src/webots_ros2/ -y --rosdistro $ROS_DISTRO
RUN source /opt/ros/${ROS_DISTRO}/setup.bash && colcon build
FROM husarnet/ros:${PREFIX}${ROS_DISTRO}-ros-base
SHELL ["/bin/bash", "-c"]
ARG ROS_DISTRO
ENV ROS_DISTRO $ROS_DISTRO
COPY --from=package-builder /webots/ /usr/local/webots/
ENV QTWEBENGINE_DISABLE_SANDBOX=1
ENV WEBOTS_HOME /usr/local/webots
ENV PATH /usr/local/webots:${PATH}
# Disable dpkg/gdebi interactive dialogs
ENV DEBIAN_FRONTEND=noninteractive
# Install Webots runtime dependencies
RUN apt-get update && apt-get install -y \
wget && \
rm -rf /var/lib/apt/lists/ && \
wget https://raw.githubusercontent.com/cyberbotics/webots/master/scripts/install/linux_runtime_dependencies.sh && \
chmod +x linux_runtime_dependencies.sh && ./linux_runtime_dependencies.sh && rm ./linux_runtime_dependencies.sh && rm -rf /var/lib/apt/lists/
COPY --from=package-builder /ros2_ws /ros2_ws
RUN apt-get update --fix-missing -y && apt-get install -y python3-rosdep && \
# without this line (using vulcanexus base image) rosdep init throws error: "ERROR: default sources list file already exists:"
rm -rf /etc/ros/rosdep/sources.list.d/20-default.list && \
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install --ignore-src --from-path src/webots_ros2/ -r -y --rosdistro $ROS_DISTRO && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV USERNAME=root
RUN echo $(cat /ros2_ws/src/webots_ros2/webots_ros2_husarion/package.xml | grep '<version>' | sed -r 's/.*<version>([0-9]+.[0-9]+.[0-9]+)<\/version>/\1/g') >> /version.txt