Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SonarQube on Docker and local scanner
# SONAR QUBE SERVER RUN
docker run --rm \
-p 9000:9000 \
-v sonarqube_conf:/opt/sonarqube/conf \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_logs:/opt/sonarqube/logs \
-v sonarqube_data:/opt/sonarqube/data \
sonarqube
# SONAR QUBE SCANNER
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip
unzip sonar-scanner-cli-4.2.0.1873-linux.zip
ln -s sonar-scanner-4.2.0.1873-linux sonar-scanner
ln -s /opt/sonar-scanner/bin/sonar-scanner /usr/local/bin/
echo -e '#!/bin/bash\nexport SONAR_SCANNER_HOME=/opt/sonar-scanner\n\
export PATH=$PATH:$SONAR_SCANNER_HOME/bin' > /etc/profile.d/sonar-scanner.sh
export SONAR_SCANNER_HOME=/opt/sonar-scanner
export PATH=$PATH:$SONAR_SCANNER_HOME/bin
# CREATE sonar-project.properties IN YOUR PROJECT AS FOLLOWS
sonar.projectKey=$PROJECTKEYINSONARQUBESERVER
sonar.projectName=$PROJECTKEYINSONARQUBESERVER
sonar.projectVersion=$VERSION
# Source to be analised
sonar.sources=./src/app
# Source to be ignored
# sonar.exclusions=./src/vendor
# Language
sonar.language=php
# Encoding of the source files
sonar.sourceEncoding=UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment