-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (56 loc) · 1.98 KB
/
Dockerfile
File metadata and controls
65 lines (56 loc) · 1.98 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
FROM ubuntu:22.04
# 1. Setup Environment (Root)
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=America/US
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# 2. Install Basic System Dependencies & Locales
RUN apt-get update && apt-get install -y \
curl \
wget \
ca-certificates \
vim \
sudo \
git \
bzip2 \
libx11-6 \
gnupg \
locales \
lsb-release \
software-properties-common \
tmux \
tzdata \
keyboard-configuration \
&& rm -rf /var/lib/apt/lists/* \
&& locale-gen en_US en_US.UTF-8 \
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
# 3. Add ROS 2 Humble Repository
RUN add-apt-repository universe \
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# 4. Install ROS 2 Humble & Tools
# Combining updates and installs prevents caching issues
RUN apt-get update && apt-get upgrade -y && apt-get install -y \
ros-humble-ros-base \
ros-humble-rosbag2-storage-mcap \
ros-humble-cv-bridge \
ros-humble-rosbag2-py \
ros-humble-sensor-msgs \
python3-pip \
python3-opencv \
&& rm -rf /var/lib/apt/lists/*
# 5. Install Python PIP Packages
# Note: Using 'python3 -m pip' avoids some path issues
RUN python3 -m pip install --no-cache-dir \
numpy==1.25.2
# 6. Create User & Setup Workspace (Still Root)
ARG USERNAME=converter
RUN useradd -ms /bin/bash ${USERNAME} \
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& echo "source /opt/ros/humble/setup.bash" >> /home/${USERNAME}/.bashrc
# 7. Finalize (Switch to User)
USER ${USERNAME}
WORKDIR /home/${USERNAME}
# Add local bin to path (for pip installed tools)
ENV PATH="/home/${USERNAME}/.local/bin:${PATH}"
CMD ["/bin/bash"]