Skip to content

Commit

Permalink
Further cleanup in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
amarburg committed Aug 25, 2023
1 parent d121d41 commit 66ca13b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
ARG BUILD_TYPE=clone
ARG ROS_VERSION=iron

#====================================================================
Expand All @@ -19,6 +18,7 @@ WORKDIR /tmp
RUN apt-get update && apt-get install -y \
git \
python3-vcstool \
ros-${ROS_VERSION}-diagnostic-updater \
ros-${ROS_VERSION}-generate-parameter-library \
wget \
&& apt autoremove -y \
Expand Down Expand Up @@ -79,24 +79,24 @@ CMD ["/bin/bash"]
#====================================================================
# Intermediate image with cloned Git repos
#====================================================================
FROM ci as build_clone
FROM ci as clone

ARG WS_DIR=/home/$USERNAME/ros_ws
ONBUILD WORKDIR ${WS_DIR}/src
WORKDIR ${WS_DIR}/src

ARG ARENA_CAMERA_ROS2_REPO=https://github.com/apl-ocean-engineering/arena_camera_ros2.git
ARG ARENA_CAMERA_ROS2_BRANCH=master
ONBUILD RUN echo "Cloning from ${ARENA_CAMERA_ROS2_BRANCH} branch ${ARENA_CAMERA_ROS2_REPO}"
RUN echo "Cloning from ${ARENA_CAMERA_ROS2_BRANCH} branch ${ARENA_CAMERA_ROS2_REPO}"

# This will break cache when the repo changes
ONBUILD ADD https://api.github.com/repos/apl-ocean-engineering/arena_camera_ros2/git/refs/heads/${ARENA_CAMERA_ROS2_BRANCH} version.json
ONBUILD RUN git clone -b ${ARENA_CAMERA_ROS2_BRANCH} ${ARENA_CAMERA_ROS2_REPO}
ADD https://api.github.com/repos/apl-ocean-engineering/arena_camera_ros2/git/refs/heads/${ARENA_CAMERA_ROS2_BRANCH} version.json
RUN git clone --depth 1 -b ${ARENA_CAMERA_ROS2_BRANCH} ${ARENA_CAMERA_ROS2_REPO}

#====================================================================
# Final image with built ROS2 packages
#====================================================================
# dockerfile_lint - ignore
FROM build_${BUILD_TYPE} as arena_camera_ros2
FROM clone as arena_camera_ros2

ARG ROS_VERSION
ARG WS_DIR
Expand Down

0 comments on commit 66ca13b

Please sign in to comment.