Use CLion with Docker (eic-shell)
Using CLion to develop EICrecon code in a Docker container can be extremely useful. One main reason is that it gives the advantage of using all of the pre-compiled dependencies already in eic-shell, but it also supports running the gdb debugger inside of the container (something that currently can't be done inside singularity).
Note that one can run CLion itself inside a Docker or singularity(apptainer) container. The integration of the "Docker toolchain" in CLion makes it work particularly nicely with the host OS though.
Here is the outline:
- Pull the Docker image
- docker pull eicweb/jug_xl:nightly
- Clone the EICrecon repository to the host
- git clone git@github.com:eic/EICrecon EICrecon-docker
- Start CLion and point it to the repository
- Click "Manage toolchains..." and add a "Docker" toolchain
- Select the Docker image to use
- Modify the "Container Settings" to mount a data directory and allow debugging
- Specify that location of cmake inside the container (e.g. /usr/local/bin/cmake)
You should be good to go. CLion will take care of binding the EICrecon source directory to "/tmp" inside the container with appropriate user id etc.
NOTE: The eicweb/jug_xl:nightly Docker image is updated frequently and can take a few minutes to download and unpack. CLion/Docker will automatically do this when it sees an updated version is available which can be a little disruptive to a workflow. If this is an issue, you can look for a different tag that is updated less frequently on Docker hub here:
https://hub.docker.com/r/eicweb/jug_xl/tags
When CLion is first opened in the newly cloned EICrecon directory, it will automatically open the Project Wizard window. Click the "Manage toolchains ..." link.
In the "Toolchains" window, click the "+" button and add a "Docker" toolchain. Make sure the correct image is selected and then modify the "Container Settings".
n.b. To modify the container settings you must click the gear on the far right of the field
Change the "CMake" setting to be "/usr/local/cmake" since this is where it is installed in the container.
After closing the "Toolchains" window, you will return to the Project Wizard. Select "Docker" as the "Toolchain". Click "OK".