Hi, I know this is a BIG question, but I’m trying to give some context.
I need to mount a Continuous Integration platform using Jenkins, Sonarqube, Testlink, Mantis, Artillery, JUnit, MySQL, Spring Boot and React. The goal is to be able to push some code into github and that would trigger a build, test, deploy in jenkins. I started dockerizing the app itself (Spring Boot API backend, React frontend, using MySQL). All of this LOCALLY (for now). But I have a problem when trying to build a Maven project for the backend inside a docker container (i.e. executing mvn clean install inside a container), because the project requires a MySQL database that I don’t have available at the moment of the build (I do it in a Dockerfile, meaning, when I build the image of the backend), so I can’t actually build the project, rendering that image useless. I need a way to make a Dockerfile and a docker-compose.yml to:
- Start the MySQL container
- Start the backend (Spring) container, build the Maven project, start the app and connect to MySQL
- Start the frontend (React) container, build the project for production and be able to connect to the backend API container (e.g. localhost:8080/api/products)
Is there a way to do that or do I have to build the maven project manually and then start the containers with the pre-build app inside? What’s the best path I have to take in order to achieve doing this via Jenkins in the future? (I’m guessing I’ll have to create a docker-compose file with all the services inside so they can connect to each other).
Thanks.