Dockerized SonarQube Scanner
The SonarQube Scanner is recommended as the default launcher to analyse a project with SonarQube.
There is now an official docker image provided by SonarQube. You can get it here.
A sonar-project.properties
(or it’s equivalent in dynamic configuration) is required in the root of you project with as a minimum the following values:
sonar.projectKey=uniqueKey
sonar.projectName=Project Name
sonar.projectVersion=0.0.1
sonar.sources=.
sonar.projectDescription=Project Description
By default https://sonarcloud.io
is assumed to be the server to connect to.
docker run --rm --user $(id -u):$(id -g) -w /data -v $(pwd):/data localgod/docker-sonarqube-scanner:1.1.1 -Dsonar.login=08b0d2062d8e20008c92d29f314ab5bea728448e <more_parameters_if_required>
You can override this by providing the server name as an environment variable:
docker run --rm --user $(id -u):$(id -g) -e "SONAR_HOST=http://localhost:9000" -w /data -v $(pwd):/data localgod/docker-sonarqube-scanner:1.1.1 <parameters_if_required>