Introduction

# check docker version
docker --version
# check docker-compose version
docker-compose --version
# check .NET Core version
dotnet --version
docker --version
# Docker version 20.10.5, build 55c4c88
docker-compose.exe --version
# docker-compose version 1.28.5, build c4eb3a1f
dotnet --version
# 5.0.201
CREATE DATABASE sonar;
version: '3.8'services:
sonarqube:
image: sonarqube:8.8.0-community # (1)
container_name: tehpeng-sonarqube
ports:
- 9123:9000
- 9124:9092
networks:
- rosepalette-network
environment:
- SONARQUBE_JDBC_URL=jdbc:postgresql://tehpeng-postgres:5432/sonar #(2)
- SONARQUBE_JDBC_USERNAME=root #(3)
- SONARQUBE_JDBC_PASSWORD=P@ssW0rd123! #(4)
volumes: #(5)
- ./data/sonarqube_conf:/opt/sonarqube/conf
- ./data/sonarqube_data:/opt/sonarqube/data
- ./data/sonarqube_extensions:/opt/sonarqube/extensions
- ./data/sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins
networks:
tehpeng-network:
name: tehpeng-network
docker-compose -f [your directory]/docker-compose.yml up -d
sudo sysctl vm.max_map_count=262144
sudo sysctl fs.file-max=65536
SonarQube initial page
SonarQube initial page
Created a project in SonarQube successfully.
Created a project in SonarQube successfully.
dotnet tool install — global dotnet-sonarscanner
dotnet sonarscanner begin /k:"[Project Key]" /d:sonar.host.url="[SonarQube Host URL]" /d:sonar.login="[SonarQube Project Token]" /d:"sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml"
dotnet build
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
dotnet sonarscanner end /d:sonar.login="[SonarQube Project Token]"
Project code analysis
Project code analysis

IT Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store