I have a Java application that needs a MySQL/MariaDB database in order to work. My goal is to build a standalone Docker image for it. I have looked up a number of tutorials but they seem to contradict what I want to achieve. This makes me doubt whether my goal is appropriate in the first place, but I still can't see why it wouldn't be a reasonable one.
I do not care for sharing the MySQL server to have multiple databases on it. It's only important that the DB of the application be there, nothing else.
What is the right way to proceed to build such a Docker image?
Do I make two containers with docker-compose, one for the DB and one for the Java application? That's what most seem to suggest, but I want an image that can just be pulled from a registry and will work out of the box.
Do I make a single image FROM a MySQL/MariaDB image and add Java and my application to it?
Do I make a single image FROM an OpenJDK image and add MySQL/MariaDB and my application to it?
is there another way to proceed?
Many thanks