Skip to content

ivanamat/sonarscanner-net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

SonarQube Scanner for .NET

This repository contains a simple and clean Dockerfile and Entrypoint script to build a Docker image of SonarQube scanner for .NET.

Library versions

  • base image: mcr.microsoft.com/dotnet/sdk:8.0
  • jre: openjdk-17-jre
  • dotnet-sonarscanner: 6.2.0
  • dotnet-reportgenerator-globaltool: 5.3.0

Build

Yoy can build the image downloading code and executing:

docker build -t sonarscanner-net .

Environment

In order to run the container, you need to specify the environment variables.

SONAR_HOST sechema://host:port of your SonarQube instance. Default is http://localhost:9000
SONAR_TOKEN Required. SonarQube token.
PROJECT_KEY Required. Project KEY
PROJECT_PATH Required. Path to your.csproj or .nls file

Use

docker run -v /home/user/samples:/samples -e SONAR_HOST='<https://my-sonar-host:port>' -e SONAR_TOKEN='<my-sonar-token>' -e PROJECT_KEY='<my-sonar-project-key>' -e PROJECT_PATH='/samples/my/sonar/project/path' -it sonarscanner-net

NOTE: If the image is to be used on GitHub or GitLab pipeline, mounting the source code path is unnecessary.

Donwload image from DockerHub

If you do not want to build the image, you can download the image from DockerHub.

ivanamat/sonarscanner-net