Docker Toolchain - Running shell script before executing C++ application
Answered
Hello,
I have multiple executables that I am building using the cmake profile configured with the Docker toolchain. One of the executables requires a bash script to be run within the container before launching it. As I understand, Clion doesnt provide docker toolchain support for bash scripts yet. Are there any workarounds or suggestions for this?
Please sign in to leave a comment.
Could you please clarify your final goal? probably executing custom_command from cmake could help.
We have few db setup scripts that needs to be executed before running the executables. Depending on the use case these scripts may or may not need to be run before running the executables. If I add it as a custom_command in cmake then I will have to build each time I want to execute the applications and times when I dont need to run these scripts, I have to pass a cmake argument to skip that command?
Ah, I see. But to be honest I'm not sure that special script helps in case of Docker Toolchain. The reason is quite simple docker container doesn't save the state between executions (except files in attached volumes), technically for each process we run separate container.
For you case I'd better prepare several different docker images, each for different script, than create several Docker Toolchains, and map each toolchain to different CMake configuration, e.g.
Thanks for the suggestion. I will try this out.
I have another question. Is it possible for to run multiple processes simultaneously (i.e one process in the background) or will both of them run on separate containers?
CLion runs each process (build app, execute app) in separate container, but this containers could be run simultaneously.