Setup SonarQube in a Docker Container and Bootstrap the Quality Configurations

Описание к видео Setup SonarQube in a Docker Container and Bootstrap the Quality Configurations

#sonarqube #docker #quality

Setup SonarQube in a Docker Container and Bootstrap the Quality Configurations

Docker Projects - https://github.com/techforum-repo/doc...
Docker Commands - https://gist.github.com/techforum-rep...

SonarQube® is an automatic code review tool to detect bugs, vulnerabilities and code smells in your code. It can integrate with your existing workflow to enable continuous code inspection across your project branches and pull requests

It has a server component where you can create projects and apply configurations like adding plugins, defining quality profiles and quality gates - The Quality Gate lets you know if your project is ready for production. there is a scanner component where it scans your codebase and sends the result to the server to show in the SonarQube dashboard.

The sonarqube can be installed as a standalone server in a system but docker based installation is very quick and easy to manage.

There are multiple versions of SonarQube but we’re going to use the community edition which is free and open source.

I am going to enable the setup in the windows server, as a first step ensure the docker for desktop for windows is installed in the system and started.

As a simple step we can run the docker container from sonarqube and quickly start the server but our requirement is to add custom plugins and bootstrap the configurations

docker pull sonarqube

docker run -d --name sonarqube -p 9000:9000 sonarqube:latest (run in background)
docker run --name sonarqube -p 9000:9000 sonarqube:latest

Here we are using the default H2 database, this is not recommended for production use but should be OK for development.

In our case, the default container should be extended to add the additional functionalities

I have already published a container image with the customizations - custom plugins and quality configurations

docker push techforum/sonarqube-with-custom-plugins-aem:latest

docker run --rm --name sonarqube -p 9000:9000 -e SONARQUBE_ADMIN_PASSWORD="Welcome1" techforum/sonarqube-with-custom-plugins-aem:latest


docker run --rm --name sonarqube -p 9000:9000 -v /mnt/c/Albin/blogData/docker-container-files/data:/opt/sonarqube/data -v /mnt/c/Albin/blogData/docker-container-files/logs:/opt/sonarqube/logs -e SONARQUBE_ADMIN_PASSWORD="Welcome1" techforum/sonarqube-with-custom-plugins-aem:latest

Clone this GitHub project with custom docker file and scripts- https://github.com/techforum-repo/doc...

Build the project - ./build.bash

Run the container

docker run --rm -p 9000:9000 -e SONARQUBE_ADMIN_PASSWORD="Welcome1" techforum/sonarqube-with-custom-plugins-aem:latest

docker run --rm -p 9000:9000 -v /mnt/c/Albin/blogData/docker-container-files/data:/opt/sonarqube/data -v /mnt/c/Albin/blogData/docker-container-files/logs:/opt/sonarqube/logs -e SONARQUBE_ADMIN_PASSWORD="Welcome1" techforum/sonarqube-with-custom-plugins-aem:latest

Scan a project - mvn -Dsonar.login=admin -Dsonar.password=Welcome1 clean install sonar:sonar

The SonarQube dashboard(http://localhost:9000) is now displaying the quality details.

Push the modified container image to your docker user ./release.bash

Комментарии

Информация по комментариям в разработке