-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
86 lines (75 loc) · 2.45 KB
/
Dockerfile
File metadata and controls
86 lines (75 loc) · 2.45 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
FROM ros:humble-ros-base
# Set ROS distro
ENV ROS_DISTRO=humble
# Set arguments for user creation
ARG USERNAME=fabian
ARG USER_UID=1000
ARG USER_GID=$USER_UID
#Create USER
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Update and install necessary packages for ROS2
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y sudo curl gnupg2 lsb-release net-tools python3-pip \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - \
&& echo "deb http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list
# Update and install all packages for work and usefull tools
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y \
sudo \
git \
wget \
nano \
python3-pip \
ros-${ROS_DISTRO}-tf2-tools \
ros-${ROS_DISTRO}-robot-state-publisher \
ros-${ROS_DISTRO}-joint-state-publisher \
ros-${ROS_DISTRO}-xacro \
ros-${ROS_DISTRO}-rviz2 \
ros-${ROS_DISTRO}-hardware-interface \
ros-${ROS_DISTRO}-urdf \
ros-${ROS_DISTRO}-urdfdom \
ros-${ROS_DISTRO}-rviz-default-plugins \
ros-${ROS_DISTRO}-rqt-robot-steering \
ros-${ROS_DISTRO}-rqt-tf-tree \
ros-${ROS_DISTRO}-camera-calibration-parsers \
ros-${ROS_DISTRO}-v4l2-camera \
ros-${ROS_DISTRO}-camera-calibration \
ros-${ROS_DISTRO}-apriltag-ros \
ros-${ROS_DISTRO}-image-pipeline \
ros-${ROS_DISTRO}-camera-calibration \
ros-${ROS_DISTRO}-ros2controlcli \
ros-${ROS_DISTRO}-ur \
iputils-ping \
libcanberra-gtk-module \
libcanberra-gtk3-module \
at-spi2-core x11-apps xauth \
libgflags-dev \
libdw-dev \
nlohmann-json3-dev \
libcanberra-gtk-module \
libcanberra-gtk3-module \
at-spi2-core \
x11-apps \
xauth \
alsa-utils \
pulseaudio \
python3-pip \
portaudio19-dev \
--fix-missing
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Initialize rosdep (run as user)
RUN sudo rosdep init || true \
&& rosdep update
# Add source into .bashrc
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc
#Login as our user
USER $USERNAME
#Prepare working dir
RUN mkdir -p /home/$USERNAME/ros2_ws/src
CMD ["bash"]