diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 0000000..d4ada5f --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,26 @@ +# docker-bake.hcl +group "default" { + targets = ["base", "overlay_arm64", "overlay_amd64"] +} + +target "base" { + dockerfile = "docker/Dockerfile" + tags = ["ghcr.io/bjoernellens1/ros2_rmp/rmp:base"] +} + +target "overlay_arm64" { + inherits = ["base"] + dockerfile = "docker/Dockerfile.arm64" + platforms = ["linux/arm64"] +} + +target "overlay_amd64" { + inherits = ["base"] + dockerfile = "docker/Dockerfile.amd64" + platforms = ["linux/amd64"] +} + +target "db" { + dockerfile = "Dockerfile.db" + tags = ["docker.io/username/db"] +} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile.amd64 similarity index 89% rename from docker/Dockerfile rename to docker/Dockerfile.amd64 index a1d61d3..bd7c315 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile.amd64 @@ -1,5 +1,5 @@ ARG ROS_DISTRO=humble -ARG UNDERLAY_WS=/bot_mini_ws +ARG UNDERLAY_WS=/rmp_ws ######################################## # Base Image for Bot Mini Control # @@ -9,13 +9,13 @@ ENV ROS_DISTRO=${ROS_DISTRO} SHELL ["/bin/bash", "-c"] # Create Colcon workspace with external dependencies -RUN mkdir -p /bot_mini_ws/src -WORKDIR /bot_mini_ws/src +RUN mkdir -p /rmp_ws/src +WORKDIR /rmp_ws/src COPY dependencies.repos . RUN vcs import < dependencies.repos # Build the base Colcon workspace, installing dependencies first. -WORKDIR /bot_mini_ws +WORKDIR /rmp_ws RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ && apt-get update -y \ && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \ @@ -42,7 +42,7 @@ RUN vcs import < overlay.repos WORKDIR /overlay_ws # COPY ./tb3_autonomy/ ./src/tb3_autonomy/ # COPY ./tb3_worlds/ ./src/tb3_worlds/ -RUN source /bot_mini_ws/install/setup.bash \ +RUN source /rmp_ws/install/setup.bash \ && colcon build --symlink-install \ && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 new file mode 100644 index 0000000..2abdef7 --- /dev/null +++ b/docker/Dockerfile.arm64 @@ -0,0 +1,59 @@ +ARG ROS_DISTRO=humble +ARG UNDERLAY_WS=/rmp_ws + +######################################## +# Base Image for Bot Mini Control # +######################################## +FROM ros:${ROS_DISTRO} as base +ENV ROS_DISTRO=${ROS_DISTRO} +SHELL ["/bin/bash", "-c"] + +# Create Colcon workspace with external dependencies +RUN mkdir -p /rmp_ws/src +WORKDIR /rmp_ws/src +COPY dependencies.repos . +RUN vcs import < dependencies.repos + +# Build the base Colcon workspace, installing dependencies first. +WORKDIR /rmp_ws +RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ + && apt-get update -y \ + && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \ + && colcon build --symlink-install + +# Use Cyclone DDS as middleware +RUN apt-get update && apt-get install -y --no-install-recommends \ + ros-${ROS_DISTRO}-rmw-cyclonedds-cpp +ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp + +ENV UNDERLAY_WS=${UNDERLAY_WS} + +########################################### +# Overlay Image for Bot Mini Control # +########################################### +FROM base AS overlay + +# Create an overlay Colcon workspace +RUN mkdir -p /overlay_ws/src +WORKDIR /overlay_ws/src +COPY overlay.repos . +RUN vcs import < overlay.repos + +WORKDIR /overlay_ws +# COPY ./tb3_autonomy/ ./src/tb3_autonomy/ +# COPY ./tb3_worlds/ ./src/tb3_worlds/ +RUN source /rmp_ws/install/setup.bash \ + && colcon build --symlink-install \ + && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y + +# Set up the entrypoint +COPY ./docker/entrypoint.sh / +RUN chmod +x /entrypoint.sh + +COPY ./controller_startup.sh / +RUN chmod +x /controller_startup.sh + +COPY ./localization_startup.sh / +RUN chmod +x /localization_startup.sh + +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file