Skip to content
This repository has been archived by the owner on Nov 16, 2020. It is now read-only.
/ sonnar-scanner Public archive

Repository to host a dockerized sonar scanner build files

License

Notifications You must be signed in to change notification settings

joaonsantos/sonnar-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Notice

This repository is now archived since there is now an official image. Please visit https://github.com/SonarSource/sonar-scanner-cli-docker.

Overview

This repository hosts the docker image build files for a dockerized sonar scanner cli application.

On Dockerhub: https://hub.docker.com/r/joaonsantos/sonar-scanner

Documentation

Documentation can be found on the official sonar scanner documentation page, at https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/.

Quick Usage

After setting up Sonar Qube instance, create a new project: Setup Project Generate Token

Following the setup instructions an example command is shown. Otherwise you can use this more complete command:

docker run --rm --name sonar-scanner joaonsantos/sonar-scanner:latest \
      -Dsonar.projectName=<project_name> \
      -Dsonar.projectKey=<project_key> \
      -Dsonar.host.url=<sonar_qube_host_url> \
      -Dsonar.login=<sonar_qube_login> \
      -Dsonar.projectVersion=<project_version> \
      -Dsonar.sources=<path_to_src_folder>

You can also add a sonar-project.properties file to the project root. Example shown in docs:

# must be unique in a given SonarQube instance
sonar.projectKey=<project_key>

# --- optional properties ---

# defaults to project key
#sonar.projectName=<project_name>
# defaults to 'not provided'
#sonar.projectVersion=<project_version>

# Path is relative to the sonar-project.properties file. Defaults to .
#sonar.sources=<path_to_src_folder>

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

There are more properties detailed in the documentation, please do take a look.

In this case you can simply run

docker run --name sonar-scanner joaonsantos/sonar-scanner:latest

at the project root.