I want to create a docker image for wordpress, which creates a ready to use wp instance with already setup and completed installation, activated theme and plugins and other configurations. I was exploring WP CLI to do that as part of the Dockerfile build, however it turned out that this is a stateful process (it requires existing mysql database already in place), which is impossible during docker build.
I'm thinking about creating a bash script which brings up a docker WP CLI container and a pure ubuntu/php container. The wp cli container will then install and setup the wp instance on the ubuntu/php container which will become the defacto WP container, and at last the wp cli container will be shut down by the script.
I'm not sure if this is a good solution, do you have better advises for this use case?