-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.dev
120 lines (102 loc) · 3.09 KB
/
Dockerfile.dev
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
109
110
111
112
113
114
115
116
117
118
119
120
FROM osrf/ros:humble-desktop AS base
ARG USERNAME=ROD
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ARG DEBIAN_FRONTEND=noninteractive
# Set default shell to bash
SHELL ["/bin/bash", "-c"]
# Graphics and compilation packages and env for dev only
# Set up X11
ENV export DISPLAY=:0.0
ENV export QT_QUICK_BACKEND=software
ENV QT_X11_NO_MITSHM 1
ENV PATH /usr/lib/ccache:$QT_DESKTOP/bin:$PATH
RUN apt-get update && apt-get -y install libnss3 \
libxcomposite1 libxdamage1 libxrandr2 libxtst6 \
&& rm -rf /var/lib/apt/lists/*
# libxss1 libasound2 libatk-bridge2.0-0 libatspi2.0-0 libvpx5 libevent-2.1-6 libicu60 -y
RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
apt-utils \
binutils \
build-essential \
ca-certificates \
ccache \
checkinstall \
cmake \
curl \
espeak \
fuse \
g++ \
gcc \
git \
gosu \
kmod \
libespeak-dev \
libfontconfig1 \
libfuse2 \
libgstreamer-plugins-base1.0-dev \
libgstreamer1.0-0 \
libgstreamer1.0-dev \
libsdl2-dev \
libssl-dev \
libudev-dev \
locales \
make \
ninja-build \
openssh-client \
openssl \
patchelf \
pkg-config \
rsync \
speech-dispatcher \
wget \
xvfb \
zlib1g-dev \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN apt-get update && apt-get install -y \
'^libxcb.*-dev' libx11-xcb-dev \
libglu1-mesa-dev libxrender-dev \
libxi-dev libxkbcommon-dev libxkbcommon-x11-dev \
libxkbcommon-x11-0 libxcb-xinerama0 libxcb-* \
libxcb-xinerama0-dev libxkbcommon-x11-dev \
&& rm -rf /var/lib/apt/lists/*
# Install necessary packages for hardware access
RUN apt-get update && apt-get install -y \
apt-utils \
build-essential \
ros-humble-gazebo-* \
ros-humble-micro-ros-msgs \
cmake \
python3-serial \
python3-pip \
libusb-1.0-0-dev \
libxml2-dev \
libxslt-dev \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd --gid "$USER_GID" "$USERNAME" \
&& useradd -s /bin/bash --uid "$USER_UID" --gid "$USER_GID" -m "$USERNAME" \
&& echo "$USERNAME" ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/"$USERNAME" \
&& chmod 0440 /etc/sudoers.d/"$USERNAME" \
&& echo "\n# Added by ROD Dockerfile:" >> /home/"$USERNAME"/.bashrc \
&& echo "source /usr/share/bash-completion/completions/git" >> /home/"$USERNAME"/.bashrc
RUN usermod -a -G dialout "$USERNAME"
# Switch to our new user
USER $USERNAME
ENV USER=$USERNAME
# Create a workspace directory
RUN mkdir -p /home/"$USERNAME"/ros2_ws/src
RUN source /opt/ros/humble/setup.bash
RUN echo "source /opt/ros/humble/setup.bash" >> /home/"$USERNAME"/.bashrc
RUN echo "source /home/ROD/ros2_ws/install/setup.bash" >> /home/"$USERNAME"/.bashrc
# Copy your ROS 2 packages into the container
#COPY ./src /$USERNAME/ros2_ws/src
# Install dependencies and build the ROS 2 workspace
WORKDIR /home/$USERNAME/ros2_ws
RUN source /opt/ros/humble/setup.bash && \
rosdep update && \
rosdep install --from-paths src --ignore-src -y && \
colcon build --symlink-install
RUN source /opt/ros/humble/setup.bash
RUN source /home/ROD/ros2_ws/install/setup.bash