I'm currently experimenting with docker with the potential of using it in future professional projects and am a bit confused about best practices.
In my experimental setup I have three docker containers, all currently running on the same server, though that might change in future projects: - Git server (Gitea) - Jenkins server - Web app (Tomcat)
Pulling the source code from git and building the war is no problem. Now I'm running into difficulties actually deploying it.
My current solution: I've modified the tomcat docker so I can deploy the resulting war to the tomcat docker and restart it inside the docker. I've read that this is bad practice and I understand the reasoning, so I need another solution.
Building the docker container from another docker container is also said to be bad practice and I also understand the reasoning for that, so that's a no-go, too.
An idea is to ssh to the host system and then either deploy the webapp to a folder shared with the tomcat container or rebuild the container. That would probably work and be future-proof if the tomcat docker moves to a different host, but it doesn't feel docker-like from my limited docker understanding.
The last idea is to make it so the tomcat docker container builds the webapp itself, i.e. does the git clone, mvn package and so on itself. That still needs to be triggered, possibly by an ssh connection to the host.
In both those cases I'd need to expose a docker-capable user to remote login, which I don't really want to do.
I can only find information on bad practice, not on how to actually solve this specific problem in a good way. What is the actual correct way to do this?