Coder Social home page Coder Social logo

xiaoyvr / sonar-scanner-cli-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sonarsource/sonar-scanner-cli-docker

0.0 1.0 0.0 20 KB

Docker image for SonarScanner CLI

License: GNU Lesser General Public License v3.0

Dockerfile 25.91% Shell 74.09%

sonar-scanner-cli-docker's Introduction

Build Status

SonarScanner CLI

This is the Git repository that contains source for SonarScanner CLI Docker images. Images are available on Docker Hub.

Beta

This image is currently in Beta testing and is made available to gather feedback.

License

Copyright 2015-2019 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0

How to run the Docker image

On Linux

To analyse the project in directory /path/to/project, you must first provide the URL to the SonarQube instance by specify it in the project's sonar-project.properties with sonar.host.url=http://foo.acme:9000.

You can then run the following command:

docker run -network=host --user="$(id -u):$(id -g)" -it -v "/path/to/project:/usr/src" sonarsource/sonar-scanner-cli

To analysis the project in the current directory:

docker run -network=host --user="$(id -u):$(id -g)" -it -v "$PWD:/usr/src" sonarsource/sonar-scanner-cli

Write permissions

The scanner writes to the analysed project directory, in directory /path/to/project/.scannerwork.

The --user option (see sample commands above) is used on Linux to have the scanner write with the same user as the one calling the docker run command.

On Mac

The command is quite similar to the one for Linux except that you don't need to specify --user option.

To analyse the project located in /path/to/project, execute:

docker run -it -v "/path/to/project:/usr/src" sonarsource/sonar-scanner-cli

To analyse the project in the current directory, execute:

docker run -it -v "$(pwd):/usr/src" sonarsource/sonar-scanner-cli

.sonar directory

The scanner downloads data from the SonarQube server it connects to. Retrieving this data can take time and certainly takes bandwidth. For efficiency, the scanner caches this data in a .sonar directory.

When running the scanner with this image, this .sonar directory is created in the project's directory. This implies caching is not happening accross analysis of multiple projects.

Caching is actually shared between projects when running the scanner natively as the .sonar is created in the home directory of the current user (eg. /home/my_user/.sonar).

Here is how you can reproduce this behavior.

  1. specify the new location of the directory in the project's sonar-project.properties with sonar.userHome=/usr/.sonar
  2. add the following option the docker run command: -v "/home/my_user/.sonar:/usr/.sonar"

Developer documentation

Developer documentation is available in DEVELOPER.md.

sonar-scanner-cli-docker's People

Contributors

michal-duda-sonarsource avatar sns-seb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.