Skip to content

Instantly share code, notes, and snippets.

@danielTobon43
Last active May 4, 2022 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielTobon43/b9c8c8536ef3f5d099920b1925ddd7bf to your computer and use it in GitHub Desktop.
Save danielTobon43/b9c8c8536ef3f5d099920b1925ddd7bf to your computer and use it in GitHub Desktop.
PCL docker

Point cloud library docker

The Point Cloud Library is an open-source library of algorithms for point cloud processing tasks and 3D geometry processing. It is a standalone, large-scale, open project for 2D/3D image and point cloud processing. PCL is released under the terms of the BSD license, and thus free for commercial and research use.

Docker Hub image: https://hub.docker.com/r/danieltobon43/pcl-docker

Environment:

  • Linux Alpine 3.15
  • VTK-9.0.0
  • PCL-1.12.1
  • Eigen-3.7.7
  • Flann
  • Boost
  • OpenGL

The idea is that the docker image will contain all the required software and library dependencies to run a PCL application. This image is not intended for development (there is no a cmake, g++, compiler). Unless a new docker image is compiled with developer tools.

Pull image

docker pull danieltobon43/pcl-docker:1.12.1-alpine3.15

Compile image

time docker build -f Dockerfile -t pcl-docker:1.0-alpine3.15 .

Dockerfile

# ============================
# Stage: base image
# ============================
# syntax=docker/dockerfile:1
ARG PCL_VERSION="1.12.1"
FROM alpine:3.15 AS pcl-dependencies
RUN apk add --no-cache boost-dev vtk-dev eigen-dev mesa-dev \
flann-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing
# ============================
# Stage: build pcl
# ============================
FROM pcl-dependencies AS build-pcl
RUN apk add --no-cache wget cmake make g++
# Download point cloud library source code once
ARG PCL_VERSION
RUN cd /tmp && wget https://github.com/PointCloudLibrary/pcl/archive/pcl-${PCL_VERSION}.tar.gz \
&& tar -xf pcl-${PCL_VERSION}.tar.gz
# PCL build modules (be aware that some modules depend from another ones)
ENV BUILD_MODULES -DBUILD_2d=ON \
-DBUILD_CUDA=OFF \
-DBUILD_GPU=OFF \
-DBUILD_apps=OFF \
-DBUILD_benchmarks=OFF \
-DBUILD_common=ON \
-DBUILD_examples=OFF \
-DBUILD_features=OFF \
-DBUILD_filters=ON \
-DBUILD_geometry=ON \
-DBUILD_global_tests=OFF \
-DBUILD_io=ON \
-DBUILD_kdtree=ON \
-DBUILD_keypoints=OFF \
-DBUILD_ml=OFF \
-DBUILD_octree=ON \
-DBUILD_outofcore=OFF \
-DBUILD_people=OFF \
-DBUILD_recognition=OFF \
-DBUILD_registration=OFF \
-DBUILD_sample_consensus=ON \
-DBUILD_search=ON \
-DBUILD_segmentation=OFF \
-DBUILD_simulation=OFF \
-DBUILD_stereo=OFF \
-DBUILD_surface=OFF \
-DBUILD_tools=OFF \
-DBUILD_tracking=OFF \
-DBUILD_visualization=ON
# Install pcl at /tmp/pcl-pcl-${PCL_VERSION}/install
ENV CMAKE_CONFIG -DCMAKE_INSTALL_PREFIX:PATH=/tmp/pcl-pcl-${PCL_VERSION}/install \
-DCMAKE_BUILD_TYPE=Release
# Set flags support
ENV WITH_CONFIG -DWITH_CUDA=OFF \
-DWITH_DAVIDSDK=OFF \
-DWITH_DOCS=OFF \
-DWITH_DSSDK=OFF \
-DWITH_ENSENSO=OFF \
-DWITH_LIBUSB=OFF \
-DWITH_OPENGL=ON \
-DWITH_OPENMP=ON \
-DWITH_OPENNI=OFF \
-DWITH_OPENNI2=OFF \
-DWITH_PCAP=OFF \
-DWITH_PNG=OFF \
-DWITH_QHULL=OFF \
-DWITH_QT=NO \
-DWITH_RSSDK=OFF \
-DWITH_RSSDK2=OFF \
-DWITH_VTK=ON
# Set vtk backend rendering
ARG VTK_CONFIG -DVTK_RENDERING_BACKEND=OpenGL2
# Compile pcl
RUN cd /tmp/pcl-pcl-${PCL_VERSION} \
&& mkdir build install && cd build \
&& cmake ${BUILD_MODULES} ${CMAKE_CONFIG} ${WITH_CONFIG} ../ \
&& make -j$(nproc) \
&& make install
# Unset ENV variables
ENV BUILD_MODULES=
ENV CMAKE_CONFIG=
ENV WITH_CONFIG=
# ============================
# Stage: runtime
# ============================
FROM pcl-dependencies as runtime
ARG PCL_VERSION
COPY --from=build-pcl /tmp/pcl-pcl-${PCL_VERSION}/install /usr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment