Git Product home page Git Product logo

dotnet_sonarscanner's Introduction

.Net Core Sonar Scanner on Docker Container

Sonar Scanner Dockerfile for .Net Core Projects

This is based on the burakince/docker-dotnet-sonarscanner image but updated to work nicely with dotnet 3.1 and 5.0

Docker Pulls Docker Automated build Docker Image Size

Using Example

First of all you need a sonarqube server. If you haven't one, run this code;

docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube

And then you need .Net Core project.

Take login token from sonarqube server, change working directory to project directory and run this code;

docker run --name dotnet-scanner -it --rm -v $(pwd):/project \
  -e PROJECT_KEY=ConsoleApplication1 \
  -e PROJECT_NAME=ConsoleApplication1 \
  -e PROJECT_VERSION=1.0 \
  -e HOST=http://localhost:9000 \
  -e LOGIN_KEY=CHANGE_THIS_ONE \
  alexwoollam/docker-dotnet-sonarscanner

Note: If you have sonarqube as docker container, you must inspect sonarqube's bridge network IP address and use it in HOST variable.

docker network inspect bridge

Works well with docker-compose, e.g. something like: docker-compose.sonarqube.yml


version: "3.7"

services:

  sonarqube:
    container_name: sonarqube
    image: sonarqube:latest
    ports:
      - "9000:9000"
    networks:
      - sonarnet
    volumes:
      - sonarqube_data:/opt/sonarqube/data
      - sonarqube_conf:/opt/sonarqube/conf

  sonarscanner:
    container_name: sonarscanner
    image: alexwoollam/docker-dotnet-sonarscanner:3.1
    networks:
      - sonarnet
    volumes:
      - ./:/project
    environment:
      - PROJECT_KEY=Project.Key
      - PROJECT_NAME=Project.Name
      - PROJECT_VERSION=1.0
      - HOST=http://sonarqube:9000
      - LOGIN_KEY=login.key

networks:
  sonarnet:

volumes:
  sonarqube_conf:
  sonarqube_data:

then docker-compose -f ./docker-compose.sonarqube.yml up -d

dotnet_sonarscanner's People

Contributors

alexwoollam avatar burakince avatar

Watchers

 avatar  avatar

Forkers

anjingyong

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.