Browse Source

integrated Sonarqube settings into dockerfile

xiaoct 7 years ago
parent
commit
f79fd73ae4
3 changed files with 21 additions and 1 deletions
  1. 2 0
      .gitignore
  2. 8 1
      Dockerfile
  3. 11 0
      sonar-runner.properties

+ 2 - 0
.gitignore

@@ -2,3 +2,5 @@ dist
 node_modules
 .DS_Store
 *.css
+.scannerwork/.sonar_lock
+.scannerwork/report-task.txt

+ 8 - 1
Dockerfile

@@ -8,7 +8,14 @@ FROM ubuntu
 # File Author / Maintainer
 # MAINTAINER name Chunteng Xiao
 RUN apt-get update
-RUN apt-get install -y nodejs nginx npm
+RUN apt-get install -y nodejs nginx npm curl
+RUN curl --insecure -o ./sonarscanner.zip -L https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
+RUN unzip sonarscanner.zip
+RUN rm sonarscanner.zip
+ENV SONAR_RUNNER_HOME=/root/sonar-scanner-3.2.0.1227-linux
+ENV PATH $PATH:/root/sonar-scanner-3.2.0.1227-linux/bin
+COPY sonar-runner.properties ./sonar-scanner-3.2.0.1227-linux/conf/sonar-scanner.properties
+CMD sonar-scanner -Dsonar.projectBaseDir=./src
 RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
 ADD default /etc/nginx/sites-available
 EXPOSE 80

+ 11 - 0
sonar-runner.properties

@@ -0,0 +1,11 @@
+#Configure here general information about the environment, such as SonarQube DB details for example
+#No information about specific project should appear here
+
+#----- Default SonarQube server
+sonar.host.url=http://localhost:9000
+
+#----- Default source code encoding
+sonar.sourceEncoding=UTF-8
+sonar.projectKey=BI-web
+sonar.sources=./src/
+sonar.login=23d8e28c74cffc70119fb26cf893dd6044440b33