-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile.melodic
108 lines (94 loc) · 3.51 KB
/
Dockerfile.melodic
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
FROM nvidia/cudagl:11.4.2-devel-ubuntu18.04
ARG CARLA_VERSION=0.9.11
ARG GID=1000
ARG UID=1000
ENV NVIDIA_VISIBLE_DEVICES ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# add new sudo user
ENV USERNAME melodic
ENV HOME /home/$USERNAME
RUN groupadd -f -g ${GID} ${USERNAME}
RUN useradd -m $USERNAME -u ${UID} -g ${GID} && \
echo "$USERNAME:$USERNAME" | chpasswd && \
usermod --shell /bin/bash $USERNAME && \
usermod -aG sudo $USERNAME && \
mkdir /etc/sudoers.d && \
echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
less \
emacs \
tmux \
bash-completion \
command-not-found \
software-properties-common \
xsel \
xdg-user-dirs \
python-pip \
python-protobuf \
python-pexpect \
pcl-tools \
libomp5 \
vulkan-utils \
curl \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Vulkan
RUN mkdir -p /etc/vulkan/icd.d && \
echo '{ "file_format_version" : "1.0.0", "ICD" : { "library_path" : "libGLX_nvidia.so.0", "api_version" : "1.1.99" } }' > /etc/vulkan/icd.d/nvidia_icd.json
RUN echo > /etc/ld.so.preload
# ROS Melodic
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-melodic-desktop-full \
python-rosdep \
python-rosinstall \
python-rosinstall-generator \
python-wstool \
build-essential \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# addtional ROS package
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-melodic-derived-object-msgs \
ros-melodic-ackermann-msgs \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# addtional python package
RUN pip install \
transforms3d==0.3.1 \
networkx==2.2 \
pygame==1.9.6
RUN rosdep init
USER $USERNAME
WORKDIR /home/$USERNAME
RUN rosdep update
SHELL ["/bin/bash", "-c"]
COPY --chown=melodic:melodic CARLA_${CARLA_VERSION}.tar.gz /home/${USERNAME}/
RUN sudo mkdir /opt/carla-simulator && \
sudo tar xfvz CARLA_${CARLA_VERSION}.tar.gz -C /opt/carla-simulator/ && \
rm /home/${USERNAME}/CARLA_${CARLA_VERSION}.tar.gz
# build CARLA ROS bridge
RUN mkdir -p ~/catkin_ws/src && \
source /opt/ros/melodic/setup.bash && \
catkin_init_workspace ~/catkin_ws/src && \
cd ~/catkin_ws/src && \
git clone --recursive https://github.com/carla-simulator/ros-bridge.git -b ${CARLA_VERSION} && \
cd ~/catkin_ws && \
catkin_make -DCMAKE_BUILD_TYPE=Release && \
source ~/catkin_ws/devel/setup.bash
# build CARLA ScenarioRunner
RUN cd /home/$USERNAME && \
git clone https://github.com/carla-simulator/scenario_runner.git -b v${CARLA_VERSION} && \
sudo pip install -r scenario_runner/requirements.txt
RUN sudo python -m easy_install /opt/carla-simulator/PythonAPI/carla/dist/carla-${CARLA_VERSION}-py2.7-linux-x86_64.egg
RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc && \
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc && \
echo "export SCENARIO_RUNNER_PATH=/home/$USERNAME/scenario_runner" >> ~/.bashrc && \
echo "export PYTHONPATH=\${PYTHONPATH}:/opt/carla-simulator/PythonAPI/carla" >> ~/.bashrc