forked from cornellev/rc-brain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.deploy
47 lines (37 loc) · 1.47 KB
/
Dockerfile.deploy
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
# syntax=docker/dockerfile:1.7-labs
FROM ros:humble
SHELL ["/bin/bash", "-c"]
ARG FOLDER_NAME=rc-brain
ARG WORKSPACE_DIR=/home/hogsmeade
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
# for some reason we need to do this
RUN rm /var/lib/dpkg/info/libc-bin.*
RUN apt-get clean
RUN apt-get update
RUN apt-get install libc-bin
RUN rosdep update --rosdistro $ROS_DISTRO
RUN mkdir -p src/$FOLDER_NAME
# 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
RUN cd src && \
git clone https://github.com/Slamtec/sllidar_ros2.git && \
cd sllidar_ros2 && \
git checkout 3430009
RUN source /opt/ros/$ROS_DISTRO/setup.bash && rosdep install --from-paths src -r -y
RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build
# Install self dependencies with rosdep
COPY --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 apt-get clean
# Build
COPY . src/$FOLDER_NAME
RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build
# Copy entrypoint script
COPY entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/bin/bash", "/home/hogsmeade/entrypoint.sh"]