-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
85 lines (71 loc) · 3.1 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
# https://hub.docker.com/r/nvidia/cuda
FROM nvidia/cuda:12.3.0-runtime-ubuntu22.04 as base
ENV TZ=Europe
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /ros2_ws
VOLUME /ros2_ws
# Install some dependencies
RUN apt update && \
apt-get install software-properties-common -y && \
apt update -y && \
add-apt-repository universe -y && \
apt install python3-pip -y && \
apt-get install build-essential -y && \
apt-get install clang-tidy clang-format -y && \
apt install -y inetutils-ping netcat iproute2
# Install ROS 2:Humble
RUN apt update && \
apt install -y curl gnupg2 lsb-release && \
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
RUN apt update && \
apt install -y ros-humble-desktop && \
rm -rf /var/lib/apt/lists/*
EXPOSE 11311
RUN echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc
# hide build warnings
RUN pip install setuptools==58.2.0
# Source ROS workspaces if exists
RUN echo "[ -e /ros2_ws/install/setup.bash ] && source /ros2_ws/install/setup.bash" >> /root/.bashrc
# docker Webots
RUN apt update && \
mkdir -p /etc/apt/keyrings && \
apt-get install wget -y && \
apt-get install software-properties-common -y && \
cd /etc/apt/keyrings && \
wget -q https://cyberbotics.com/Cyberbotics.asc && \
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/Cyberbotics.asc] https://cyberbotics.com/debian binary-amd64/" | tee /etc/apt/sources.list.d/Cyberbotics.list && \
apt update && \
apt-get install webots=2023b -y && \
apt install ros-humble-webots-ros2 -y
EXPOSE 12345
ENV WEBOTS_HOME=/usr/local/webots
ENV LD_LIBRARY_PATH=$WEBOTS_HOME/lib/controller:$LD_LIBRARY_PATH
# Project dependencies
RUN apt-get update --fix-missing
RUN apt install python3-colcon-common-extensions -y && \
pip install rosdep
# Groot
RUN apt install -y qtbase5-dev qt5-qmake cmake libqt5svg5-dev
EXPOSE 5555
# First time ROS setup
RUN rosdep init && rosdep update
ENV DEBIAN_FRONTEND newt
# allow SSH sessions to container
RUN apt-get update && \
apt-get install -y openssh-server && \
mkdir /var/run/sshd
RUN echo 'root:toor' | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
EXPOSE 22
RUN echo "pgrep -x sshd > /dev/null || { echo "Starting SSH server in background..."; /usr/sbin/sshd & }" >> /root/.bashrc
RUN echo "cd /ros2_ws" >> /root/.bashrc
# install dependencies on first start
RUN echo "[ -e /tmp/dependencies.lock ] || { touch /tmp/dependencies.lock && command -v make && make dependencies; }" >> /root/.bashrc
# build workspace on first start
RUN echo "[ -e /tmp/build.lock ] || { touch /tmp/build.lock && command -v make && make build; }" >> /root/.bashrc
FROM base as ci
COPY ./ros2_ws /ros2_ws
WORKDIR /ros2_ws
RUN /bin/bash -c "source /opt/ros/humble/setup.bash && make dependencies && make build"