Running C++ executable using Flask in Docker

Hi Folks,

I’m looking for a bit of guidance. I’ve got a flask app which runs a c++ executable using Pythons subprocess and sends the response back through the api endpoint.

All works fine on my laptop but now I want to put it in Docker. I can run a flask app in docker but the C++ app is proving a little trickier.

I found a tutorial that set up a dockerfile for gpp, so I can run the executable and print out the response in Docker Desktop/cmd… but the container immediately stops after the file has run so how would I run it from my flask container?

How should I set up the containers so that flask can run the executable? Do I need two different containers talking through ports? or the flask app and exe file in one container that has pyhon and gpp base images? If it’s two different containers, then how do I stop the gpp container stopping so I can access it from the flask app and run the exe?