-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.deploy
More file actions
53 lines (39 loc) · 1.78 KB
/
Copy pathDockerfile.deploy
File metadata and controls
53 lines (39 loc) · 1.78 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
# syntax=docker/dockerfile:1.7-labs
FROM ros:humble
SHELL ["/bin/bash", "-c"]
# Set up CEV user
RUN useradd -m -s /bin/bash cev
RUN usermod -aG sudo cev
# Grant passwordless sudo access to the 'sudo' group
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER cev
# Docker doesn't do this by default
RUN sudo chown -R cev /home/cev
ARG FOLDER_NAME=rc-brain
ARG WORKSPACE_DIR=/home/cev
WORKDIR $WORKSPACE_DIR
# Source the ROS2 environment automatically when a new shell is created
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc
RUN echo "source $WORKSPACE_DIR/install/setup.bash" >> ~/.bashrc
# Init rosdep and update package index
RUN sudo apt-get update
RUN rosdep update --rosdistro $ROS_DISTRO
# Install and build build-from-source packages
# We do this as a separate step from the stuff for our code, since that changes more frequently
COPY --chown=cev --parents external/**/package.xml src/$FOLDER_NAME/
RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y
# Run install_extra.sh, which installs additional dependencies
COPY --chown=cev scripts/install_extra.sh src/$FOLDER_NAME/scripts/
RUN sudo src/$FOLDER_NAME/scripts/install_extra.sh
# Finally build external packages
COPY --chown=cev external src/$FOLDER_NAME/external/
RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install
# Install all other dependencies
COPY --chown=cev --parents **/package.xml src/$FOLDER_NAME/
RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y
# Clean up apt cache to make container smaller
RUN sudo apt-get clean
# Build
COPY --chown=cev . src/$FOLDER_NAME
RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build --symlink-install
ENTRYPOINT ["/bin/bash", "/home/cev/src/rc-brain/scripts/deployed_entrypoint.sh"]