-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (42 loc) · 1.78 KB
/
Copy pathDockerfile
File metadata and controls
53 lines (42 loc) · 1.78 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
# Build argument for ROS distro (humble or jazzy)
ARG ROS_DISTRO=humble
FROM osrf/ros:${ROS_DISTRO}-desktop-full
# Arguments for building
ARG USERID
ARG USER
ARG ROS_DISTRO
# Setup environment
ENV TERM=linux
ENV DEBIAN_FRONTEND=noninteractive
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
# Copy requirement files and install dependencies
COPY docker/requirements.txt .
RUN apt-get update && apt-get install --no-install-recommends -y $(cat requirements.txt)
RUN rm requirements.txt
# Copy ROS requirement files and install ROS dependencies
# This pre-installs ROS dependencies to speed up rosdep install
COPY docker/ros_requirements.txt .
RUN apt-get update && apt-get install --no-install-recommends -y $(sed "s/\${ROS_DISTRO}/${ROS_DISTRO}/g" ros_requirements.txt | grep -v '^#' | grep -v '^$')
RUN rm ros_requirements.txt
# Create a user with passwordless sudo
RUN adduser --uid $USERID --gecos "ekumen developer" --disabled-password $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN echo "export QT_X11_NO_MITSHM=1" >> /home/$USER/.bashrc
USER $USER
# Adds USER to dialout and plugdev group.
# This is needed to access the serial ports, for further references check
# the libserial documentation.
RUN sudo usermod -a -G dialout $USER
RUN sudo usermod -a -G plugdev $USER
# Creates the src folder of the workspace.
RUN mkdir -p /home/$USER/ws/src
# Adds to bashrc the ROS overlay sourcing.
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USER/.bashrc
# Adds colcon autocomplete
RUN echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /home/$USER/.bashrc
# Updates
RUN sudo apt upgrade -y && sudo apt update && rosdep update
# Defines a workspace folder.
WORKDIR /home/$USER/ws
CMD ["/bin/bash"]