-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.Webots
99 lines (80 loc) · 2.75 KB
/
Dockerfile.Webots
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
FROM cyberbotics/webots:R2021a-ubuntu20.04
LABEL maintainer="Emiliano Borghi"
ENV USER=create2
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},display
# install packages
RUN apt-get update && apt-get -q -y install --no-install-recommends \
bash-completion \
dirmngr \
gnupg2 \
lsb-release \
python3-pip \
sudo \
tmux \
&& rm -rf /var/lib/apt/lists/*
# Create a user with passwordless sudo
USER root
RUN adduser --gecos "Development User" --disabled-password -u 1000 $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# https://cyberbotics.com/doc/guide/running-extern-robot-controllers#running-extern-robot-controllers
ENV PYTHONPATH=${PYTHONPATH}:${WEBOTS_HOME}/lib/controller/python3
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${WEBOTS_HOME}/lib/controller
# Audio support
RUN usermod -aG audio $USER
RUN apt-get update && apt-get install -y alsa-utils
# ROS 2 Foxy
# setup keys
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# setup sources.list
RUN echo "deb http://packages.ros.org/ros2/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros2-latest.list
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get install -y \
ros-foxy-ros-base \
ros-foxy-webots-ros2
# install bootstrap tools
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential \
git \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
&& rm -rf /var/lib/apt/lists/*
# install python packages
RUN pip3 install -U \
argcomplete \
flake8 \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures
# This is a workaround for pytest not found causing builds to fail
# Following RUN statements tests for regression of https://github.com/ros2/ros2/issues/722
RUN pip3 freeze | grep pytest \
&& python3 -m pytest --version
# Permissions to workspace
RUN mkdir -p /colcon_ws
RUN chown -R $USER:$USER /colcon_ws
# Webots config
RUN mkdir -p /home/$USER/.config/Cyberbotics
COPY --chown=$USER:$USER Webots-R2021a.conf /home/$USER/.config/Cyberbotics/Webots-R2021a.conf
# Tmux config
COPY --chown=$USER:$USER .tmux.conf /home/$USER/.tmux.conf
# rosdep
RUN apt-get update
RUN rosdep init
USER $USER
RUN rosdep update
# setup ros2 environment
RUN echo ". /opt/ros/foxy/setup.bash" >> /home/$USER/.bashrc
ENV COLCON_SETUP_BASH "/colcon_ws/install/local_setup.bash"
RUN echo "[[ -f ${COLCON_SETUP_BASH} ]] && . ${COLCON_SETUP_BASH}" >> /home/$USER/.bashrc