CloudCompare / CloudComPy

Python wrapper for CloudCompare
Other
292 stars 41 forks source link

I've made a small minimal Dockerfile to test CloudComPy #10

Open arkanoid87 opened 3 years ago

arkanoid87 commented 3 years ago

I wanted to test CloudComPy but the install instructions were quite convoluted to get to the point, so I wrapped up a self-contained Dockerfile that setup a minimal environment based on continuum.io anaconda images that passes all the tests in headless mode.

This could be useful to document install steps on linux but also for CI.

Now it uses binary packages from https://www.simulation.openfields.fr/, but it could be improved to build the required tools.

FROM continuumio/miniconda3:master

RUN . /opt/conda/etc/profile.d/conda.sh && \
    conda activate && \
    conda create --name CloudComPy39 python=3.9 && \
    conda activate CloudComPy39 && \
    conda config --add channels conda-forge && \
    conda config --set channel_priority strict && \
    conda install qt numpy psutil boost xerces-c pcl gdal cgal cmake pdal opencv ffmpeg mysql "qhull=2019.1" matplotlib "eigen=3.3.9" tbb openmp

RUN mkdir -p /opt/cloudcompy && \
    wget "https://www.simulation.openfields.fr/index.php/download-binaries/send/2-cloudcompy-binaries/8-cloudcompy-conda39-linux64-20211018-tgz" && \
    tar -xvzf "8-cloudcompy-conda39-linux64-20211018-tgz" -C /opt/cloudcompy && \
    rm "8-cloudcompy-conda39-linux64-20211018-tgz"

RUN apt-get update && apt-get install -y libgl1

RUN echo "#!/bin/bash\n\
\n\
. /opt/conda/etc/profile.d/conda.sh\n\
conda activate CloudComPy39\n\
export LD_LIBRARY_PATH=/opt/conda/envs/CloudComPy39/lib:\${LD_LIBRARY_PATH}\n\
export LD_LIBRARY_PATH=/opt/cloudcompy/installConda39/lib/cloudcompare:\${LD_LIBRARY_PATH}\n\
export LD_LIBRARY_PATH=/opt/cloudcompy/installConda39/lib/cloudcompare/plugins:\${LD_LIBRARY_PATH}\n\
export QT_QPA_PLATFORM=offscreen\n\
cd /opt/cloudcompy/installConda39/doc/PythonAPI_test\n\
ctest" > /entrypoint.sh && chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]

output:

Test project /opt/cloudcompy/installConda39/doc/PythonAPI_test
      Start  1: PYCC_test001
 1/25 Test  #1: PYCC_test001 .....................   Passed    5.60 sec
      Start  2: PYCC_test002
 2/25 Test  #2: PYCC_test002 .....................   Passed   11.40 sec
      Start  3: PYCC_test003
 3/25 Test  #3: PYCC_test003 .....................   Passed    3.22 sec
      Start  4: PYCC_test004
 4/25 Test  #4: PYCC_test004 .....................   Passed    1.89 sec
      Start  5: PYCC_test005
 5/25 Test  #5: PYCC_test005 .....................   Passed    2.52 sec
      Start  6: PYCC_test006
 6/25 Test  #6: PYCC_test006 .....................   Passed    5.30 sec
      Start  7: PYCC_test007
 7/25 Test  #7: PYCC_test007 .....................   Passed    3.19 sec
      Start  8: PYCC_test008
 8/25 Test  #8: PYCC_test008 .....................   Passed    2.54 sec
      Start  9: PYCC_test009
 9/25 Test  #9: PYCC_test009 .....................   Passed    3.31 sec
      Start 10: PYCC_test010
10/25 Test #10: PYCC_test010 .....................   Passed   10.84 sec
      Start 11: PYCC_test011
11/25 Test #11: PYCC_test011 .....................   Passed    3.20 sec
      Start 12: PYCC_test012
12/25 Test #12: PYCC_test012 .....................   Passed    1.18 sec
      Start 13: PYCC_test013
13/25 Test #13: PYCC_test013 .....................   Passed    2.10 sec
      Start 14: PYCC_test014
14/25 Test #14: PYCC_test014 .....................   Passed    9.72 sec
      Start 15: PYCC_test015
15/25 Test #15: PYCC_test015 .....................   Passed    1.36 sec
      Start 16: PYCC_test016
16/25 Test #16: PYCC_test016 .....................   Passed    2.83 sec
      Start 17: PYCC_test017
17/25 Test #17: PYCC_test017 .....................   Passed    3.30 sec
      Start 18: PYCC_test018
18/25 Test #18: PYCC_test018 .....................   Passed    2.29 sec
      Start 19: PYCC_test019
19/25 Test #19: PYCC_test019 .....................   Passed    5.23 sec
      Start 20: PYCC_test020
20/25 Test #20: PYCC_test020 .....................   Passed    5.40 sec
      Start 21: PYCC_test021
21/25 Test #21: PYCC_test021 .....................   Passed   19.16 sec
      Start 22: PYCC_test022
22/25 Test #22: PYCC_test022 .....................   Passed    4.59 sec
      Start 23: PYCC_test023
23/25 Test #23: PYCC_test023 .....................   Passed    3.12 sec
      Start 24: PYCC_test024
24/25 Test #24: PYCC_test024 .....................   Passed   22.46 sec
      Start 25: PYCC_test025
25/25 Test #25: PYCC_test025 .....................   Passed    3.61 sec

100% tests passed, 0 tests failed out of 25

Total Test time (real) = 139.37 sec
dgirardeau commented 3 years ago

That looks very interesting, but I'll let @prascle give his thoughts.

Would it be possible to use that to trigger some automatic tests such as what we do on the main repository of CloudCompare?

prascle commented 3 years ago

Nice script! I'll integrate it in the readme (yes, I probably need to restructure the readme :-) ). The build script is a good idea, I'm thinking about it but I haven't had the courage to do it yet, I want something robust.

@dgirardeau, I realize that I don't know what tools you use for the automatic tests of CloudCompare, and what you're thinking about (builds and tests at the integration of commits?)

dgirardeau commented 3 years ago

Yes, I don't know how it works exactly with the main CloudCompare repo, but we use some Continuous Integration mechanism of github to trigger builds whenever a new commit is made. And I just thought that this kind of self contained docker package could help running tests as well. But I wouldn't be able to do it myself 😅.

Brainkite commented 1 year ago

Building is successful but all tests fails. (windows 11 Docker desktop here) Any chance you could publish a functionning cloudcompy docker image on docker hub (https://hub.docker.com/) ?

prascle commented 1 year ago

Have you taken a look at issue #89? I'll think about publishing a docker image, if it seems feasible without taking too much time... Best, Paul