Giter Site home page Giter Site logo

moisei / sonar-runner-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spujadas/sonar-runner-docker

0.0 3.0 0.0 124 KB

Docker image for SonarQube Runner, the recommended default launcher to analyse a project with SonarQube

License: GNU Lesser General Public License v3.0

sonar-runner-docker's Introduction

Docker image for SonarQube Runner

SonarQube Runner is recommended as the default launcher to analyse a project with SonarQube.

Contents

  • Usage
    • Option 1 – Run SonarQube Runner against dockerised SonarQube
    • Option 2 – Run SonarQube Runner against regular SonarQube
  • Build
    • Build with Docker
    • Build with Docker Compose
  • About

Usage

Create a sonar-project.properties file in the directory containing the project to be analysed, as described on the Analyzing with SonarQube Runner page of SonarQube's documentation site.

Here's an sample file for a project named My project, with code to be analysed in the app subdirectory of the project:

sonar.projectKey=my:project
sonar.projectName=My project
sonar.projectVersion=1.0
sonar.sources=app
sonar.sourceEncoding=UTF-8

Then cd to the project's directory and run SonarQube Runner using one of the two options presented below.

Option 1 – Run SonarQube Runner against dockerised SonarQube

Prerequisite – Start a SonarQube container (e.g. sonarqube) with ports 9000 and 9092 exposed, and get its name (e.g. sonarqubedocker_sonarqube_1 in the example below).

In the command below, adapt:

  • the --link option to use the actual name of the SonarQube container,

  • the -Dsonar.* options as needed.

Here it goes...

docker run --link sonarqubedocker_sonarqube_1:sonarqube \
  --entrypoint /opt/sonar-runner-2.4/bin/sonar-runner \
  -e SONAR_USER_HOME=/data/.sonar-cache \
  -v $(pwd):/data -u $(id -u) sebp/sonar-runner \
    -Dsonar.host.url=http://sonarqube:9000 \
    -Dsonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar \
    -Dsonar.jdbc.username=sonar \
    -Dsonar.jdbc.password=sonar \
    -Dsonar.jdbc.driverClassName=org.h2.Driver \
    -Dsonar.embeddedDatabase.port=9092

Option 2 – Run SonarQube Runner against regular SonarQube

Run the command below, adapting the -Dsonar.* options as needed, especially the -Dsonar.host.url and -Dsonar.jdbc.url options, where the example value sonarqube has to be replaced with the hostname of your SonarQube server.

docker run --entrypoint /opt/sonar-runner-2.4/bin/sonar-runner \
  -e SONAR_USER_HOME=/data/.sonar-cache \
  -v $(pwd):/data -u $(id -u) sebp/sonar-runner \
    -Dsonar.host.url=http://sonarqube:9000 \
    -Dsonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar \
    -Dsonar.jdbc.username=sonar \
    -Dsonar.jdbc.password=sonar \
    -Dsonar.jdbc.driverClassName=org.h2.Driver \
    -Dsonar.embeddedDatabase.port=9092

Build

First clone or download the spujadas/sonar-runner-docker GitHub repository, open a shell in the newly created sonar-runner-docker directory, then build the image and run a container using Docker or Docker Compose, as explained below.

Build with Docker

This command will build the image:

$ sudo docker build .

Build with Docker Compose

Build the image with this command:

$ sudo docker-compose build

About

Written by Sébastien Pujadas, released under the under the GNU Lesser GPL License, Version 3.

sonar-runner-docker's People

Contributors

spujadas avatar

Watchers

James Cloos avatar Moisei Rabinovich avatar  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.