From 27bd1e986c34c1122905a98943347f4096763cc9 Mon Sep 17 00:00:00 2001 From: Yik Teng Hie Date: Tue, 21 Jun 2022 20:35:46 +0800 Subject: [PATCH] sonarqube --- sonarqube/README.md | 54 ++++++++++++++++++++++++++++++++++++ sonarqube/docker-compose.yml | 11 ++++++++ 2 files changed, 65 insertions(+) create mode 100644 sonarqube/README.md create mode 100644 sonarqube/docker-compose.yml diff --git a/sonarqube/README.md b/sonarqube/README.md new file mode 100644 index 0000000..85f19a2 --- /dev/null +++ b/sonarqube/README.md @@ -0,0 +1,54 @@ +# SonarQube + +[Reference](https://docs.sonarqube.org/latest/setup/get-started-2-minutes/) + +Docker + +```sh +$ docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest + +``` + +docker-compose.yml + +```yaml +# Use admin/admin as user/password credentials +version: '3.1' + +services: + + sonarqube: + image: 'sonarqube:latest' + environment: + - SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true + #restart: always + ports: + - "9000:9000" + +``` + + + +Run docker compose + +```sh +$ docker-compose up -d +``` + +Browse [localhost](http://localhost:9000) + +Credential + +* Login : admin + +* Password : admin + +## Create Project + +Now that you're logged in to your local SonarQube instance, let's analyze a project: + +1. Click the **Create new project** button. +2. Give your project a **Project key** and a **Display name** and click the **Set Up** button. +3. Under **Provide a token**, select **Generate a token**. Give your token a name, click the **Generate** button, and click **Continue**. +4. Select your project's main language under **Run analysis on your project**, and follow the instructions to analyze your project. Here you'll download and execute a Scanner on your code (if you're using Maven or Gradle, the Scanner is automatically downloaded). + diff --git a/sonarqube/docker-compose.yml b/sonarqube/docker-compose.yml new file mode 100644 index 0000000..ef9435d --- /dev/null +++ b/sonarqube/docker-compose.yml @@ -0,0 +1,11 @@ +# Use admin/admin as user/password credentials +version: '3.1' + +services: + sonarqube: + image: 'sonarqube:9.5-community' + environment: + - SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true + #restart: always + ports: + - "9000:9000"