@@ -18,15 +18,19 @@ RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o
1818 && 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
1919
2020# Install and configure ROS infrastructure tools
21- RUN apt update \
22- && apt install -y python3-vcstool python3-colcon-common-extensions python3-rosdep \
21+ RUN apt update -y -qq \
22+ && apt install -y -qq python3-vcstool python3-colcon-common-extensions python3-rosdep \
2323 && rosdep init \
2424 && rosdep update
2525
2626# Install the dependency repositories
27+ # Use a tmpfs mount for the workspace so as not to unnecessarily copy files into the final image
2728# Bind mount the source directory so as not to unnecessarily copy source code into the docker image
28- ARG WORKSPACE_DIR=/opt/tesseract
29- RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract \
29+ ARG WORKSPACE_DIR=/tmpfs/tesseract
30+ ARG INSTALL_DIR=/opt/tesseract/install
31+ RUN mkdir -p ${INSTALL_DIR}
32+
33+ RUN --mount=type=tmpfs,target=${WORKSPACE_DIR} --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract \
3034 cd ${WORKSPACE_DIR} \
3135 && if [ "$TAG" = "focal" ]; then \
3236 vcs import src < src/tesseract/dependencies_focal.repos --shallow; \
@@ -35,11 +39,6 @@ RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract \
3539 fi \
3640 && rosdep install \
3741 --from-paths ${WORKSPACE_DIR}/src \
38- -iry
39-
40- # Build the repository
41- # Bind mount the source directory so as not to unnecessarily copy source code into the docker image
42- RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/tesseract \
43- cd ${WORKSPACE_DIR} \
42+ -iry \
4443 && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
45- && rm -rf build log
44+ && cp -r ${WORKSPACE_DIR}/install ${INSTALL_DIR}
0 commit comments