Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
81 lines (72 loc) · 2.81 KB
/
Copy pathDockerfile
File metadata and controls
81 lines (72 loc) · 2.81 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
FROM osrf/ros:humble-desktop
# -----------------------------------------------------------------------------
# Argumentos de build (se pueden sobreescribir desde docker-compose.yml)
# USER_UID/GID deben coincidir con tu usuario del host (`id -u`, `id -g`) para
# que build/, install/ y log/ queden con tu dueño en el volumen montado.
# -----------------------------------------------------------------------------
ARG USERNAME=ros
ARG USER_UID=1000
ARG USER_GID=1000
ARG DEBIAN_FRONTEND=noninteractive
# Install SO dependencies
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
build-essential \
python3-pip \
terminator \
gdb \
sudo \
bash-completion \
nano \
&& rm -rf /var/lib/apt/lists/*
# Install ROS dependencies
RUN apt-get update -qq && \
apt-get install -y \
ros-humble-controller-interface \
ros-humble-realtime-tools \
ros-humble-controller-manager \
ros-humble-ackermann-msgs \
ros-humble-gazebo-ros \
ros-humble-gazebo-ros-pkgs \
ros-humble-joint-state-publisher \
ros-humble-gazebo-ros2-control \
ros-humble-nav2-common \
ros-humble-nav2-bringup \
ros-humble-rqt-tf-tree \
ros-humble-tf2-tools \
ros-humble-ros2-control \
ros-humble-robot-localization \
ros-humble-foxglove-bridge \
ros-humble-diagnostic-updater \
espeak \
alsa-utils \
software-properties-common \
ffmpeg \
bluez \
portaudio19-dev \
pulseaudio-module-bluetooth \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
apt-get -y install libgl1-mesa-glx libgl1-mesa-dri mesa-utils && \
rm -rf /var/lib/apt/lists/*
# Install python dependencies
RUN pip install python-can setuptools==58.2.0
# -----------------------------------------------------------------------------
# Usuario no-root
# dialout: grupo dueño de /dev/ttyUSB* -> acceso al puerto serial del SBG.
# sudo sin contraseña: para instalar algo puntual sin rehacer la imagen.
# -----------------------------------------------------------------------------
RUN groupadd --gid ${USER_GID} ${USERNAME} && \
useradd --uid ${USER_UID} --gid ${USER_GID} -m -s /bin/bash ${USERNAME} && \
usermod -aG dialout ${USERNAME} && \
echo "${USERNAME} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME} && \
chmod 0440 /etc/sudoers.d/${USERNAME}
USER ${USERNAME}
WORKDIR /ws
# .bashrc se lee en cada shell nuevo (incluido `docker compose exec`),
# a diferencia del ENTRYPOINT, que corre una sola vez al arrancar.
RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc && \
echo "[ -f /ws/install/setup.bash ] && source /ws/install/setup.bash" >> ~/.bashrc && \
echo "alias cb='colcon build --base-paths src src/deps --symlink-install'" >> ~/.bashrc && \
echo "alias cclean='rm -rf /ws/build /ws/install /ws/log'" >> ~/.bashrc
CMD ["bash"]