I'm trying setup my Gitlab CI/CD to compile and run tests for my Java/Maven/Spring Boot application. I've setup a Gitlab Runner and created my .gitlab-ci.yml and it all worked, but VERY SLOW. I've tried many configurations for my runner, without success.
So i made a step back and tried to run the tests on Docker on my local machine.
The build + tests running directly on my machine takes 17min. The build + tests running on docker takes more than 1h.
The best performance i've got was using using this docker command:
docker run -it --rm --name comp2 --mount type=bind,source="C:/ProjetosJava/eaud",destination=/usr/src/mymaven -e MAVEN_OPTS='-Xdebug -Xnoagent -Djava.compiler=NONE -Xmx4096m -Xms1024m -XX:MaxPermSize=1024m -Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1' -w /usr/src/mymaven maven:3.3-jdk-8 /bin/bash
and inside bash i did:
mvn -s .m2/settings.xml clean compile test
I need the build inside docker to have at minimun a close time (17min).