-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
108 lines (91 loc) · 2.66 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
FROM ros:humble-ros-core-jammy
ENV ROS2_WS /workspaces
ENV ROS_DOMAIN_ID=1
ENV ROS_DISTRO=humble
ARG THREADS=4
ARG TARGETPLATFORM
SHELL ["/bin/bash", "-c"]
##### Copy Source Code #####
COPY . /tmp
##### Environment Settings #####
WORKDIR /tmp
# Copy the run command for rebuilding colcon. You can source it.
RUN mkdir -p ${ROS2_WS}/src && \
mv /tmp/rebuild_colcon.rc ${ROS2_WS} && \
# Entrypoint
mv /tmp/ros_entrypoint.bash /ros_entrypoint.bash && \
chmod +x /ros_entrypoint.bash && \
# System Upgrade
apt update && \
apt upgrade -y && \
apt autoremove -y && \
apt autoclean -y
# Necessary System Package Installation
RUN apt install -y \
axel \
bash-completion \
bat \
bmon \
build-essential \
curl \
git \
libncurses5-dev \
libncursesw5-dev \
lsof \
nano \
ncdu \
nvtop \
python3-pip \
python3-venv \
screen \
tig \
tmux \
tree \
vim \
wget
RUN pip3 install --no-cache-dir --upgrade pip && \
pip3 install --no-cache-dir -r /tmp/requirements.txt && \
# Soft Link
ln -s /usr/bin/python3 /usr/bin/python && \
ln -s /usr/bin/batcat /usr/bin/bat && \
# Install oh-my-bash
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmybash/oh-my-bash/master/tools/install.sh)" && \
# Use our pre-defined bashrc
mv /tmp/.bashrc /root && \
ln -s /root/.bashrc /.bashrc
##### ROS2 Installation #####
# install ros2
RUN apt install -y \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
ros-${ROS_DISTRO}-ros-base \
# install ros bridge
ros-${ROS_DISTRO}-rosbridge-suite ccache
# install boost serial and json
RUN apt install -y \
libboost-all-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-thread-dev \
libserial-dev \
nlohmann-json3-dev
# bootstrap rosdep
RUN rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
# setup colcon mixin and metadata
colcon mixin add default \
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \
colcon mixin update && \
colcon metadata add default \
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \
colcon metadata update && \
##### Post-Settings #####
# Clear tmp and cache
rm -rf /tmp/* && \
rm -rf /temp/* && \
rm -rf /var/lib/apt/lists/*
WORKDIR ${ROS2_WS}
ENTRYPOINT [ "/ros_entrypoint.bash" ]
CMD ["bash", "-l"]