-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
194 lines (159 loc) · 6.95 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
# Handle ros distro
ARG ROS_DISTRO=noetic
FROM ghcr.io/aica-technology/ros-ws:${ROS_DISTRO}
# User provided arguments
ARG HOST_GID=1000
ARG GIT_NAME=""
ARG GIT_EMAIL=""
ARG USE_SIMD=OFF
# Tell docker we want to use bash instead of sh in general
SHELL ["/bin/bash", "-c"]
### Add the user to the current GID of the host to avoid permisson issues in volumes
# AICA uses the same name for user and user group
ENV USER_GROUP=${USER}
USER root
RUN if [ "HOST_GID" != "1000"] ; \
then groupadd --gid ${HOST_GID} host_group && \
usermod ${USER} -g ${HOST_GID} && \
usermod ${USER} -a -G ${USER_GROUP}; fi
USER ${USER}
# Setup git identity
RUN git config --global user.name "${GIT_NAME}"
RUN git config --global user.email "${GIT_EMAIL}"
# Setup python version for noetic
RUN sudo apt update
RUN if [ "${ROS_DISTRO}" == "noetic" ] ; \
then sudo apt install python-is-python3 ; fi
### Add a few tools
RUN sudo apt-get update && sudo apt-get install -y \
bash-completion \
silversearcher-ag \
apt-transport-https \
less \
alsa-utils \
ros-${ROS_DISTRO}-ros-control \
ros-${ROS_DISTRO}-ros-controllers \
net-tools \
netbase \
&& sudo apt-get upgrade -y && sudo apt-get clean
# Install gazebo (9 or 11 depending on distro)
WORKDIR /home/${USER}
RUN sudo apt-get update
RUN if [ "$ROS_DISTRO" = "noetic" ] ; \
then sudo apt-get install -y gazebo11 ; fi
RUN if [ "$ROS_DISTRO" = "melodic" ] ; \
then sudo apt-get install -y gazebo9 ; fi
# Install gaezbo ros packages
RUN sudo apt install -y ros-${ROS_DISTRO}-gazebo-ros-pkgs \
ros-${ROS_DISTRO}-gazebo-ros-control
# Handle SIMD option
RUN if [ "${USE_SIMD}" = "ON" ] ; \
then export CMAKE_CXX_FLAGS="-march=native -faligned-new" ; fi
### Install all dependencies of IIWA ROS
# Clone KUKA FRI (need to be root to clone private repo)
WORKDIR /tmp
USER root
RUN mkdir -p -m 0775 /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN --mount=type=ssh git clone [email protected]:epfl-lasa/kuka_fri.git
WORKDIR /tmp/kuka_fri
RUN if [ "${USE_SMID}" != "ON" ] ; \
then wget https://gist.githubusercontent.com/matthias-mayr/0f947982474c1865aab825bd084e7a92/raw/244f1193bd30051ae625c8f29ed241855a59ee38/0001-Config-Disables-SIMD-march-native-by-default.patch \
; fi
RUN --mount=type=ssh if [ "${USE_SMID}" != "ON" ] ; \
then git am 0001-Config-Disables-SIMD-march-native-by-default.patch ; fi
# Transfer repo back to original user after root clone
WORKDIR /tmp
RUN chown -R ${USER}:${HOST_GID} kuka_fri
# Install kuka Fri as USER
USER ${USER}
RUN cd kuka_fri && ./waf configure && ./waf && sudo ./waf install
# Install SpaceVecAlg
RUN git clone --recursive https://github.com/jrl-umi3218/SpaceVecAlg.git
RUN cd SpaceVecAlg && mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_BINDING=OFF .. \
&& make -j && sudo make install
# Install RBDyn
RUN git clone --recursive https://github.com/jrl-umi3218/RBDyn.git
RUN cd RBDyn && mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_BINDING=OFF .. \
&& make -j && sudo make install
# Install mc_rbdyn_urdf
RUN git clone --recursive -b v1.1.0 https://github.com/jrl-umi3218/mc_rbdyn_urdf.git
RUN cd mc_rbdyn_urdf && mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_BINDING=OFF .. \
&& make -j && sudo make install
# Install corrade
RUN git clone https://github.com/mosra/corrade.git
RUN cd corrade && git checkout 0d149ee9f26a6e35c30b1b44f281b272397842f5 \
&& mkdir build && cd build && cmake .. && make -j && sudo make install
# Install robot_controller
RUN git clone https://github.com/epfl-lasa/robot_controllers.git
RUN cd robot_controllers && mkdir build && cd build \
&& cmake .. && make -j && sudo make install
# Remove temporary files
RUN sudo ldconfig
RUN sudo rm -rf /tmp/*
### Install IIWA ROS
WORKDIR /home/${USER}/ros_ws/src
RUN git clone https://github.com/epfl-lasa/iiwa_ros.git
### Add environement variables to bashrc
WORKDIR /home/${USER}
# Give bashrc back to user
RUN sudo chown -R ${USER}:${HOST_GID} .bashrc
# Add cmake option to bash rc if needed
RUN if [ "${USE_SIMD}" = "ON" ] ; \
then echo "export ENABLE_SIMD=ON" >> /home/${USER}/.bashrc ; fi
# Additional dependencies for the current package
RUN pip install mujoco \
numpy-quaternion \
sympy \
scipy \
torch==1.12.0 \
omegaconf==2.2.3 \
urdfpy==0.0.22 \
pytorch-kinematics \
open3d \
scikit-image \
pyembree \
openai \
pddl \
pyVHACD
# Install Pinocchio
RUN sudo apt install -qqy lsb-release curl
RUN sudo mkdir -p /etc/apt/keyrings && curl http://robotpkg.openrobots.org/packages/debian/robotpkg.asc | sudo tee /etc/apt/keyrings/robotpkg.asc
RUN echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/robotpkg.asc] http://robotpkg.openrobots.org/packages/debian/pub $(lsb_release -cs) robotpkg" \
| sudo tee /etc/apt/sources.list.d/robotpkg.list
RUN sudo apt update
RUN sudo apt install -qqy robotpkg-py3*-pinocchio
RUN source /home/${USER}/.bashrc && echo "export PATH=/opt/openrobots/bin:$PATH" >> /home/${USER}/.bashrc
RUN source /home/${USER}/.bashrc && echo "export PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH" >> /home/${USER}/.bashrc
RUN source /home/${USER}/.bashrc && echo "export LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH" >> /home/${USER}/.bashrc
RUN source /home/${USER}/.bashrc && echo "export PYTHONPATH=/opt/openrobots/lib/python3.8/site-packages:$PYTHONPATH" >> /home/${USER}/.bashrc
RUN source /home/${USER}/.bashrc && echo "export CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH" >> /home/${USER}/.bashrc
# Robotics toolbox from personal fork
WORKDIR /home/${USER}
RUN git clone https://github.com/niederha/robotics-toolbox-python.git && pip install ./robotics-toolbox-python
### Build ros workspace
WORKDIR /home/${USER}/ros_ws
RUN source /home/${USER}/.bashrc && rosdep install --from-paths src --ignore-src -r -y
RUN source /home/${USER}/.bashrc && catkin_make;
# For some reason we need a more recencent version of numpy
RUN pip install --upgrade numpy==1.23
# Install nvidia drivers
RUN sudo apt update
# RUN sudo apt install software-properties-common -y
# RUN sudo add-apt-repository ppa:graphics-drivers/ppa
# RUN sudo apt-get install ubuntu-drivers-common -y
# RUN sudo apt install nvidia-driver-545 -y
# RUN sudo ubuntu-drivers install
# NVIDIA driver argument
ARG nvidia_binary_version="535.159.05"
ARG nvidia_binary="NVIDIA-Linux-x86_64-${nvidia_binary_version}.run"
# RUN wget -q https://us.download.nvidia.com/XFree86/Linux-x86_64/${nvidia_binary_version}/${nvidia_binary} \
# && sudo chmod +x ${nvidia_binary} && \
# sudo ./${nvidia_binary} --accept-license --ui=none --no-kernel-module --no-questions && \
# sudo rm -rf ${nvidia_binary}
### Final apt clean
RUN sudo apt update -y
RUN sudo apt upgrade -y
RUN sudo apt clean -y