forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.ros.melodic.px4
More file actions
99 lines (83 loc) · 3 KB
/
Dockerfile.ros.melodic.px4
File metadata and controls
99 lines (83 loc) · 3 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
87
88
89
90
91
92
93
94
95
96
97
98
99
#
# this dockerfile roughly follows the 'Ubuntu install of ROS Melodic' from:
# http://wiki.ros.org/melodic/Installation/Ubuntu
#
ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r32.4.4
FROM ${BASE_IMAGE}
ARG ROS_PKG=ros_base
ENV ROS_DISTRO=melodic
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
ENV CONTAINER_USER=xaviernx
ENV DEBIAN_FRONTEND=noninteractive
#WORKDIR /workspace
# add the ROS deb repo to the apt sources list
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
gedit \
cmake \
build-essential \
curl \
wget \
gnupg2 \
lsb-release \
net-tools \
iputils-ping \
nano \
&& rm -rf /var/lib/apt/lists/*
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# install ROS packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ros-melodic-ros-base \
ros-melodic-image-transport \
ros-melodic-vision-msgs \
python-rosdep \
python-rosinstall \
python-rosinstall-generator \
python-wstool \
python-catkin-tools \
python-rosinstall-generator \
&& rm -rf /var/lib/apt/lists/*
# Add MAVLink and mavros
RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
geographiclib-tools \
libeigen3-dev \
libgeographic-dev \
libyaml-cpp-dev \
python-pip \
python-tk \
ros-$ROS_DISTRO-mav-msgs \
ros-$ROS_DISTRO-mavlink \
ros-$ROS_DISTRO-mavros \
ros-$ROS_DISTRO-mavros-extras \
&& geographiclib-get-geoids egm96-5 \
&& apt-get -y autoremove \
&& apt-get clean autoclean
# Add xaviernx user
RUN useradd --shell /bin/bash -u 1000 -c "" -m $CONTAINER_USER && usermod -a -G dialout $CONTAINER_USER && echo "$CONTAINER_USER:$CONTAINER_USER" | chpasswd && adduser $CONTAINER_USER sudo
RUN echo "source /opt/ros/melodic/setup.bash" >> /home/$CONTAINER_USER/.bashrc
RUN rosdep init && su -c "rosdep update -c /home/$CONTAINER_USER/.ros/rosdep/sources.cache" - $CONTAINER_USER
RUN echo "source /opt/ros/melodic/setup.bash" >> /home/$CONTAINER_USER/.bashrc
# Add user to dialout group
RUN usermod -aG dialout $CONTAINER_USER
RUN usermod -aG tty $CONTAINER_USER
# Switch user
USER $CONTAINER_USER
# Create src folder inside the HOME folder
# This is to host non-ROS packages to install from source
RUN cd /home/$CONTAINER_USER && mkdir src
# Create ROS catkin_ws to host ROS packages
RUN mkdir -p /home/$CONTAINER_USER/catkin_ws/src \
&& cd /home/$CONTAINER_USER/catkin_ws \
&& catkin init \
&& catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release \
&& catkin config --merge-devel \
&& catkin config --extend /opt/ros/$ROS_DISTRO \
&& catkin build
# Setup entrypoint
COPY ./packages/ros_entrypoint.sh /ros_entrypoint.sh
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
WORKDIR /home/$CONTAINER_USER