Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (53 loc) · 2.5 KB
/
Copy pathDockerfile
File metadata and controls
61 lines (53 loc) · 2.5 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
##############################################################################
## Base Image ##
##############################################################################
ARG ROS_DISTRO=humble
FROM ros:${ROS_DISTRO}-ros-base
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
##############################################################################
## Global Dependecies ##
##############################################################################
RUN apt-get update && apt-get install --no-install-recommends -y \
ros-$ROS_DISTRO-cv-bridge \
python3-pip \
python3-colcon-common-extensions \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install -U pip
RUN pip3 install -U \
setuptools \
opencv-python
##############################################################################
## Create User ##
##############################################################################
ARG USER=docker
ARG PASSWORD=docker
ARG UID=1000
ARG GID=1000
ENV UID=${UID}
ENV GID=${GID}
ENV USER=${USER}
RUN groupadd -g "$GID" "$USER" && \
useradd -m -u "$UID" -g "$GID" --shell $(which bash) "$USER" -G sudo && \
echo "$USER:$PASSWORD" | chpasswd && \
echo "%sudo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudogrp
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /etc/bash.bashrc
USER $USER
RUN mkdir -p /home/$USER/ros2_ws/src
##############################################################################
## User Dependecies ##
##############################################################################
WORKDIR /home/$USER/ros2_ws/src
COPY . ./point_transformation
##############################################################################
## Build ROS and run ##
##############################################################################
WORKDIR /home/$USER/ros2_ws
RUN . /opt/ros/$ROS_DISTRO/setup.sh && colcon build --symlink-install
RUN echo "source /home/$USER/ros2_ws/install/setup.bash" >> /home/$USER/.bashrc
RUN sudo sed --in-place --expression \
'$isource "/home/$USER/ros2_ws/install/setup.bash"' \
/ros_entrypoint.sh
CMD ["ros2", "launch", "point_transformation", "point_transformation.launch.py"]
# CMD /bin/bash