diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8c57f2c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +# Ignore everything by default +* + +# First-order allow exception for select directories +!/external +!/lidar_patterns +!/RGLServerPlugin +!/RGLVisualize + +# First-order allow exception for select files +!/CMakeLists.txt +!/package.xml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e235036 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,57 @@ +ARG BASE_IMAGE=base +FROM ros:iron AS base + +# Edit apt config for caching and update once +RUN mv /etc/apt/apt.conf.d/docker-clean /etc/apt/ && \ + echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' \ + > /etc/apt/apt.conf.d/keep-cache && \ + apt-get update + +################################################################################ +# MARK: prepper - prep rgl dependencies +################################################################################ +### Core dependencies stage +FROM $BASE_IMAGE AS prepper + +# Set working directory using standard opt path +WORKDIR /opt/rgl + +# Copy package manifest +COPY package.xml src/RGLGazeboPlugin/package.xml + +# Install bootstrap tools for install scripts +RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \ + rosdep install -y \ + --from-paths src \ + --ignore-src + +################################################################################ +# MARK: builder - build rgl binaries +################################################################################ +FROM prepper AS builder + +# Copy source tree +COPY . src/RGLGazeboPlugin + +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build + +################################################################################ +# MARK: dancer - multi-stage for cache dancing +################################################################################ +FROM builder AS dancer + +# Copy entire build directory +# RUN mkdir /dancer && \ +# cp -rT build /dancer + +# Copy only the lib and bin directories +RUN mkdir /dancer && \ + cp -rT install /dancer + +################################################################################ +# MARK: exporter - export rgl binaries and executables +################################################################################ +FROM scratch AS exporter + +COPY --from=dancer /dancer / diff --git a/README.md b/README.md index c560ec3..2f5b42b 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,15 @@ Key features: export IGN_GUI_PLUGIN_PATH=`pwd`/RGLGuiPlugin:$IGN_GUI_PLUGIN_PATH ``` ### Building from source + +#### Docker +```shell +docker build \ + --target=exporter \ + --output=install . +``` + +#### Manual ```shell mkdir build cd build diff --git a/package.xml b/package.xml new file mode 100644 index 0000000..8c90188 --- /dev/null +++ b/package.xml @@ -0,0 +1,21 @@ + + + + RGLGazeboPlugin + 0.1.2 + RGL Gazebo Plugin + Mateusz Szczygielski + Apache License 2.0 + + ament_cmake + + ignition-gazebo6 + ignition-gui6 + ignition-msgs8 + ignition-plugin + ignition-rendering6 + + + ament_cmake + +