-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
163 lines (134 loc) · 4.38 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
# Start from Ubuntu
FROM ubuntu:bionic
# Update so we can download packages
RUN apt-get update && apt-get upgrade -y
# Set the ROS distro
ENV ROS_DISTRO melodic
ARG DEBIAN_FRONTEND=noninteractive
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
# Add the ROS GPG key
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
# Add the ROS repository
RUN echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros-latest.list
# install Python 3
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-setuptools \
python3-dev
# Set up ROS
RUN apt-get update && apt-get install -y \
python-rosdep \
python-rosinstall \
python-rosinstall-generator \
python-wstool \
build-essential
# Install ROS Melodic packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-desktop-full \
ros-${ROS_DISTRO}-tf2-geometry-msgs \
ros-${ROS_DISTRO}-ackermann-msgs \
ros-${ROS_DISTRO}-navigation \
ros-${ROS_DISTRO}-xacro \
ros-${ROS_DISTRO}-joy \
python-catkin-tools \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Initialize rosdep
RUN rosdep init
RUN rosdep update
# 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 \
build-essential \
cython \
libfreetype6-dev
# Install some cool programs
RUN apt update && apt install -y \
sudo \
vim \
emacs \
nano \
gedit \
screen \
tmux \
iputils-ping \
feh
# Install Python packages
RUN python3 -m pip install --upgrade pip
RUN pip3 install transforms3d \
imutils
# Kill the bell!
RUN echo "set bell-style none" >> /etc/inputrc
# Copy in the entrypoint
COPY ./entrypoint.sh /usr/bin/entrypoint.sh
RUN chmod +x /usr/bin/entrypoint.sh
COPY ./xstartup.sh /usr/bin/xstartup.sh
RUN chmod +x /usr/bin/xstartup.sh
# add required packages
RUN apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-driver-base
# Copy your existing workspace into the Docker container
COPY ./f1tenth_ws /home/sdc/sandbox/f1tenth_ws
# Place CATKIN_IGNORE files in the realsense2 package directories to exclude them from the build
RUN touch /home/sdc/sandbox/f1tenth_ws/build/realsense2_camera/CATKIN_IGNORE \
/home/sdc/sandbox/f1tenth_ws/build/realsense2_description/CATKIN_IGNORE \
/home/sdc/sandbox/f1tenth_ws/src/realsense-ros/CATKIN_IGNORE
#delete realsense sdk for now
RUN rm -rf /home/sdc/sandbox/f1tenth_ws/build/realsense2_camera && rm -rf /home/sdc/sandbox/f1tenth_ws/build/realsense2_description && rm -rf /home/sdc/sandbox/f1tenth_ws/src/realsense-ros
# Source the ROS setup.bash file and build the workspace
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/setup.bash; cd /home/sdc/sandbox/f1tenth_ws; catkin 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 sdc
RUN echo 'sdc:[email protected]' | chpasswd
RUN usermod -aG sudo sdc
# Set permissions for /home/sdc directory
RUN chown -R sdc:sdc /home/sdc
RUN chmod -R 755 /home/sdc
USER sdc
WORKDIR /home/sdc
# Set the entrypoint
# ENTRYPOINT ["/usr/bin/entrypoint.sh"]