-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile.carla
More file actions
236 lines (200 loc) · 6.49 KB
/
Dockerfile.carla
File metadata and controls
236 lines (200 loc) · 6.49 KB
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# OPENGL SUPPORT ------------------------------------------------------------------------------
# start with plain ros as base image for testing
FROM ros:melodic AS builder
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash"
# install some needed packages and set gcc-8 as default compiler
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
llvm-7 \
llvm-dev \
autoconf \
automake \
bison \
flex \
gettext \
libtool \
python-dev\
git \
pkgconf \
python-mako \
zlib1g-dev \
x11proto-gl-dev \
libxext-dev \
xcb \
libx11-xcb-dev \
libxcb-dri2-0-dev \
libxcb-xfixes0-dev \
libdrm-dev \
g++ \
make \
xvfb \
x11vnc \
g++-8 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 && \
rm -rf /var/lib/apt/lists/*
# get mesa (using 19.0.2 as later versions dont use the configure script)
WORKDIR /mesa
RUN git clone https://gitlab.freedesktop.org/mesa/mesa.git
WORKDIR /mesa/mesa
RUN git checkout mesa-19.0.2
#RUN git checkout mesa-18.2.2
# build and install mesa
RUN libtoolize && \
autoreconf --install && \
./configure \
--enable-glx=gallium-xlib \
--with-gallium-drivers=swrast,swr \
--disable-dri \
--disable-gbm \
--disable-egl \
--enable-gallium-osmesa \
--enable-autotools \
--enable-llvm \
--with-llvm-prefix=/usr/lib/llvm-7/ \
--enable-gles1 \
--enable-gles2 \
--prefix=/usr/local && \
make -j 4 && \
make install && \
rm -rf /mesa
# UBUNTU WITH MESA GL -----------------------------------------------------------------------
FROM ros:melodic
COPY --from=builder /usr/local /usr/local
RUN /bin/bash -c "source /opt/ros/melodic/setup.bash"
# update ubuntu and install all dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
xterm \
#freeglut3 \
openssh-server \
synaptic \
nfs-common \
mesa-utils \
xfonts-75dpi \
libusb-0.1-4 \
python \
libglu1-mesa \
libqtgui4 \
gedit \
xvfb \
x11vnc \
llvm-7-dev \
expat \
nano \
dos2unix \
ros-melodic-image-transport \
ros-melodic-cv-bridge \
python-pip \
libxkbfile-dev \
libsecret-1-dev \
dos2unix \
wget \
ros-melodic-rqt \
ros-melodic-rqt* \
jwm \
ros-melodic-rviz \
ros-melodic-desktop-full \
software-properties-common &&\
rm -rf /var/lib/apt/lists/*
# copy some needed libs
COPY ./libs libs/
# insatll libpng12
RUN dpkg -i /libs/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
# install all needed python packages
RUN pip install \
#jupyterlab \
matplotlib \
tqdm \
pymongo \
h5py \
pygame \
pep8 \
autopep8 \
cmake_format==0.6.11 \
pylint \
pexpect \
simple-pid \
networkx
# === CARLA ================================================================================
#ARG CARLA_VERSION=0.9.10.1
# install carla ros bridge
# see: https://github.com/carla-simulator/ros-bridge
#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1AF1527DE64CB8D9
#RUN add-apt-repository "deb [arch=amd64] http://dist.carla.org/carla $(lsb_release -sc) main"
#RUN apt-get update &&\
# DEBIAN_FRONTEND=noninteractive apt-get install -y carla-ros-bridge &&\
# #clang-8 clang++-8 ninja-build rsync python3-pip &&\
# rm -rf /var/lib/apt/lists/*
# Build carla Python api
# see: https://carla.readthedocs.io/en/latest/build_system/
#WORKDIR /
#RUN ln -s /usr/bin/clang++-8 /usr/bin/clang++
#RUN pip install distro && pip3 install distro
#RUN git clone https://github.com/carla-simulator/carla.git &&\
# cd carla &&\
# git checkout $CARLA_VERSION
#RUN make setup
# A very very daring trick is now necessary
# see: https://github.com/carla-simulator/carla/issues/973
# TODO: check if the ros bridge is realy working. If not we should switch to the precompiled egg files!
#RUN ln -s ./PythonAPI/carla/dependencies/lib/libboost_python36.a ./PythonAPI/carla/dependencies/lib/libboost_python27.a
#RUN make PythonAPI
# install python api
# TODO: set path
#RUN easy_install2 --user --no-deps PythonAPI/dist/carla-X.X.X-py2.7-linux-x86_64.egg &&\
# easy_install3 --user --no-deps PythonAPI/dist/carla-X.X.X-py3.7-linux-x86_64.egg
# TODO: set env variable
#ENV PATH="${PYTHONPATH}:<path-to-carla>/PythonAPI/carla/dist/carla-<carla_version_and_arch>.egg"
# add carla rosbridge to sources
# TODO:
#RUN echo "source /opt/carla-ros-bridge/melodic/setup.bash" >> ~/.bashrc
WORKDIR /carla_rb_ws
RUN mkdir src &&\
cd src &&\
git clone https://github.com/carla-simulator/ros-bridge.git &&\
cd ros-bridge &&\
git submodule update --init
RUN cd /carla_rb_ws &&\
apt-get update &&\
rosdep update &&\
rosdep fix-permissions &&\
rosdep install --from-paths src --ignore-src -r -y &&\
rm -rf /var/lib/apt/lists/* &&\
/bin/bash -c '. /opt/ros/melodic/setup.bash; cd /carla_rb_ws; catkin_make'
RUN python -m easy_install --no-deps /libs/carla_0.9.10.1_rss/PythonAPI/carla/dist/carla-0.9.10-py2.7-linux-x86_64.egg
# ==========================================================================================
# get vs code server
RUN mkdir /code-server &&\
wget -qO- https://github.com/cdr/code-server/releases/download/2.1523-vsc1.38.1/code-server2.1523-vsc1.38.1-linux-x86_64.tar.gz \
| tar xvz --strip-components=1 -C /code-server
# get and setup novnc
WORKDIR /novnc
RUN git clone https://github.com/novnc/noVNC.git
# fix for offline mode -> prefatch websockify
RUN cd ./noVNC/utils && git clone https://github.com/novnc/websockify
# set the environment variables (display -> 99 and LIBGL_ALWAYS_SOFTWARE)
ENV DISPLAY=":99" \
GALLIUM_DRIVER="llvmpipe" \
LIBGL_ALWAYS_SOFTWARE="1" \
LP_DEBUG="" \
LP_NO_RAST="false" \
LP_NUM_THREADS="" \
LP_PERF="" \
MESA_VERSION="19.0.2" \
XVFB_WHD="1920x1080x24" \
MESA_GLSL="errors" \
PASSWORD="dev@ros"
# setup the entrypoint script (starts the xvfb and vnc session)
COPY ./entrypoint_code.sh /entry/
RUN dos2unix /entry/entrypoint_code.sh && chmod +x /entry/entrypoint_code.sh
ENTRYPOINT ["/entry/entrypoint_code.sh"]
# set the default shell
SHELL ["/bin/bash", "-c"]
# source ros for every new terminal session
RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
# source also carla ros bridge
RUN echo "source /carla_rb_ws/devel/setup.bash" >> ~/.bashrc
# set our workdir
WORKDIR /workspace
# expose the vnc, novnc and code-server ports
#EXPOSE 5900
EXPOSE 6080
EXPOSE 8080