- Clone the repo.
- Run
docker compose up -d --build
to build and spin up the docker containers. - Navigate to SonarQube postgres adminer via http://localhost:9001.
- On login screen select
PostgreSQL
as System, enterpostgres
as server, enterpostgres
as username and password. Then click "Login". - Create a database named
sonar
. Please note that, if the DB has been configured by a supervisor. Then you will have to import it instead of creating new DB. - Re run
docker compose up -d
command to spin up sonarqube container with the postgres database. - Navigate to Sonarqube dashboard via http://localhost:9000. The default username/password will be "admin/admin". After entering default passwords you may need to setup a new password.
- Setup the project if the project has not yet configured in SonarQube. Select
Local Project
and proceed as instructed. - Generate a project analyse token after setting up the project in SonarQube.
- Add the generated project specific token and key in to
.env
file. - Add the absoulte path for the project directory as
PROJECT_DIRECTORY_PATH
.
PROJECT_DIRECTORY_PATH=./
PROJECT_KEY=
PROJECT_TOKEN=
- Re run
docker compose up -d
command to spin up the containers with proper details. - Run
docker compose exec scanner sonar-scanner
. This command will start scanning the project and generate a report which you may access via http://localhost:9000.
Run docker compose exec scripts python ./scripts/sonar-export.py
. This will export a Excel file containing all the issues.