-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
executable file
·168 lines (122 loc) · 3.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
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
# Start from ubuntu
FROM ubuntu:focal
# Update so we can download packages
RUN apt-get update && apt-get upgrade -y
#Set the ROS distro
ENV ROS_DISTRO foxy
ARG DEBIAN_FRONTEND=noninteractive
# add the ROS deb repo to the apt sources list
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
wget \
gnupg2 \
lsb-release \
ca-certificates \
console-setup \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# Setup for ros
# Set up ROS
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-setuptools
#
# install ros2 packages
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-desktop \
python3-colcon-common-extensions \
ros-dev-tools \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Set up ROS2
RUN rosdep init
RUN rosdep update --include-eol-distros
# Install VNC and things to install noVNC
RUN apt-get update && apt-get install -y \
tigervnc-standalone-server \
wget \
git \
unzip
# Download NoVNC and unpack
ENV NO_VNC_VERSION 1.4.0
RUN wget -q https://github.com/novnc/noVNC/archive/v$NO_VNC_VERSION.zip
RUN unzip v$NO_VNC_VERSION.zip
RUN rm v$NO_VNC_VERSION.zip
RUN git clone https://github.com/novnc/websockify /noVNC-$NO_VNC_VERSION/utils/websockify
# Install a window manager
RUN apt-get update && apt-get install -y \
openbox \
x11-xserver-utils \
xterm \
dbus-x11
# Set up locales
RUN apt-get update && \
apt-get install -y --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
RUN locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV PYTHONIOENCODING=utf-8
# Install additional required packages for ROS
RUN apt update && apt install -y \
ros-$ROS_DISTRO-tf2-geometry-msgs \
ros-$ROS_DISTRO-ackermann-msgs \
ros-$ROS_DISTRO-tf-transformations \
ros-$ROS_DISTRO-navigation2 \
ros-$ROS_DISTRO-xacro \
ros-$ROS_DISTRO-joy \
build-essential \
cython
# Install some cool programs
RUN apt update && apt install -y \
sudo \
vim \
emacs \
nano \
gedit \
screen \
tmux \
iputils-ping \
feh
# # Fix some ROS things
# run apt install -y \
# python-pip \
# ros-$ROS_DISTRO-compressed-image-transport \
# libfreetype6-dev
# RUN pip install -U pip
# RUN pip install imutils
# RUN pip install -U matplotlib
# install additional ros things
RUN apt-get update && pip install transforms3d \
pip install imutils \
pip install opencv-contrib-python
# Kill the bell!
RUN echo "set bell-style none" >> /etc/inputrc
# Copy in the entrypoint
COPY ./entrypoint.sh /usr/bin/entrypoint.sh
COPY ./xstartup.sh /usr/bin/xstartup.sh
# Create racecar_ws directory and src before switching to USER
ENV SIM_WS /home/sim_ws
RUN mkdir -p $SIM_WS/src && cd $SIM_WS/src && git clone https://github.com/Sebastian-Garcia/racecar_simulator.git
RUN /bin/bash -c 'source /opt/ros/$ROS_DISTRO/setup.bash; cd $SIM_WS; colcon build;'
# Copy in default config files
COPY ./config/bash.bashrc /etc/
COPY ./config/screenrc /etc/
COPY ./config/vimrc /etc/vim/vimrc
ADD ./config/openbox /etc/X11/openbox/
COPY ./config/XTerm /etc/X11/app-defaults/
COPY ./config/default.rviz /tmp/
# Create a user
RUN useradd -ms /bin/bash racecar
RUN echo 'racecar:racecar@mit' | chpasswd
RUN usermod -aG sudo racecar
USER racecar
WORKDIR /home/racecar