Docker toolchain or remote setup for my workflow?
Answered
Hi all,
I'm looking for advice on how to configure CLion for my workflow. I primarily use Docker for testing robotics software on different versions of Ubuntu.
What I'd like is to be able to keep my source code on my host machine, but have CLion configured to use all the dependencies/build tools inside my docker container (and install the build files into the docker container when I execute a build in CLion). I've read through a lot of documentation/tutorials from Jetbrains but I'm still not sure if this is what the Docker toolchain is meant for or if I should be looking at a different remote development toolchain.
Any advice would be greatly appreciated!
Please sign in to leave a comment.
Docker toolchain allows you to avoid unnecessary source code synchronization (as it usually does for remote toolchain, from local to remote machine) as CLion simply mounts the project folder into Docker container and work with the project in Docker then. But is it a local Docker container for you?
Thanks for your quick reply Anastasia Kazakova.
Here is more info, for reference:
Linux host machine "A": Contains project files (i.e., source code, CMakeLists) and CLion install
Local docker container "B": Contains dependencies for building project A (libraries, environment, etc.)
My current solution is to mount the project folder on A into B when I start B (this handles source code sync). Then I can edit the source code inside CLion on A and when it comes time to compile & test I can build from the command line inside B. The limitation with this is that although I can change my source code inside CLion on A, I don't get any of the intelligent code assistance features because CLion is only looking on local machine A for build dependencies.
My understanding with the docker toolchain is that it will start it's own container for building, whereas what I would like is to just use the same static container over and over again so that I can quickly repeat the process of build->testing.
Edit: Another option I considered is just to install CLion as part of my docker image and then mirror the CLion GUI to my host machine. That would basically solve all my problems but not sure if there's a better way to accomplish the same functionality.
Hello Sjphilli
Yes, you are correct. For each process (like build,run,etc) CLion runs a separate container and mounts your project as a volume.
Please note that the artifacts are stored to that volume between each execution. So it seems that your particular case could be covered with current functionality. Just create the Docker Toolchain with the proper image, create or select it in proper CMake profile and try to build and execute your application. https://www.jetbrains.com/help/clion/clion-toolchains-in-docker.html