Docker container with 3D Slicer build to build and test an extension

Hi,
related to Adding a CI build to a Slicer extension, I am willing to add an additional GitHub Actions workflow to check building and testing an extension this time using a Slicer Docker image, so that I can know early if a change to the extension fails (Slicer taking above 3 hours to build).

I have done several attempts here, so far unsuccessfully:
ENH: Add Docker-assisted build, test GHA workflow · SlicerDMRI/SlicerDMRI@b030e77 · GitHub

I am pulling the nightly slicer/slicer-base:latest image.

And I am using the step below in my GHA workflow file to try to build the extension against it:

Slicer_DIR=/usr/src/Slicer-build/Slicer-build

EXTENSION_NAME=SlicerDMRI
EXTENSION_SOURCE_DIR=${{ github.workspace }}/$EXTENSION_NAME
EXTENSION_BUILD_DIR=${{ github.workspace }}/$EXTENSION_NAME-build

docker run \
  --rm \
  -v $EXTENSION_SOURCE_DIR:/usr/src/slicerdmri \
  -v $EXTENSION_BUILD_DIR:/usr/src/slicerdmri-build \
Slicer-build
  slicer/slicer-base \
  cmake \
    -GNinja \
    -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
    -DSlicer_DIR:PATH=$Slicer_DIR \
    -S /usr/src/slicerdmri \
    -B /usr/src/slicerdmri-build

It looks like I am not giving it the right Slicer build directory or I am not mapping it correctly to the Docker volume:

-- Configuring incomplete, errors occurred!
CMake Error at CMakeLists.txt:22 (find_package):
  By not providing "FindSlicer.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Slicer", but
  CMake did not find one.

  Could not find a package configuration file provided by "Slicer" with any
  of the following names:

    SlicerConfig.cmake
    slicer-config.cmake

ENH: Add Docker-assisted build, test GHA workflow · SlicerDMRI/SlicerDMRI@b030e77 · GitHub

IIUC, I am giving it the same directory as I do in my regular GHA workflow build that compiles Slicer:
Merge pull request #194 from jhlegarreta/FixSprintfWarnings · SlicerDMRI/SlicerDMRI@f95c613 · GitHub

Locally,

docker run --rm  slicer/slicer-base find . -name "SlicerConfig.cmake" -type f

or

docker run --rm  slicer/slicer-base find . -name "slicer-config.cmake" -type f

dot not provide any answer.

And

docker run --rm  slicer/slicer-base ls ./Slicer-build

does not show a meaningful directory structure (Slicer-build/share/Slicer-5.5/Slicer.crt) for this purpose.

Locally, if I do

docker run --rm 
  -v /bld/slicer:/usr/src/Slicer-build/slicer-build \
  -v /src/slicerdmri:/usr/src/slicerdmri \
  -v /bld/slicerdmri:/usr/src/slicerdmri-build \
  slicer/slicer-base \
  cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Debug \
  -DSlicer_DIR:PATH=$Slicer_DIR \
  -S /usr/src/slicerdmri \
  -B /usr/src/slicerdmri-build

I get an CMake error:

CMake Error:
The current CMakeCache.txt directory
/usr/src/slicerdmri-build/CMakeCache.txt
is different than the directory
/bld/slicerdmri where CMakeCache.txt was created.
This may result in binaries being created in the wrong place.
If you are not sure, reedit the CMakeCache.txt
CMake Error:
The source "/usr/src/slicerdmri/CMakeLists.txt"
does not match the source
"/src/slicerdmri/CMakeLists.txt"
used to generate cache.
Re-run cmake with a different source directory.

So,

Thanks.