-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added sonarQube for code quality #42
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -391,3 +391,6 @@ Temporary Items | |
dist | ||
local/ | ||
documentation | ||
|
||
# SonarQube | ||
.scannerwork |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: "3.8" | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
|
@@ -44,6 +44,32 @@ services: | |
depends_on: | ||
- mysqldb | ||
|
||
sonarqube: | ||
container_name: sonarqube | ||
image: sonarqube:8-community | ||
command: '-Dsonar.web.context=/sonarqube' | ||
volumes: | ||
- sonarqube_data:/opt/sonarqube/data | ||
- sonarqube_extensions:/opt/sonarqube/extensions | ||
- sonarqube_logs:/opt/sonarqube/logs | ||
- sonarqube_temp:/opt/sonarqube/temp | ||
ports: | ||
- 9000:9000 | ||
sonarscanner: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't we pass the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically, |
||
container_name: sonar-scanner | ||
build: | ||
context: . | ||
dockerfile: ./docker/sonar-scanner/Dockerfile | ||
volumes: | ||
- .:/usr/src/ | ||
- ./sonar-scanner.properties:/usr/lib/sonar-scanner/conf/sonar-scanner.properties | ||
network_mode: host | ||
command: tail -f /dev/null | ||
|
||
volumes: | ||
node_modules: | ||
mysqldata: | ||
sonarqube_data: | ||
sonarqube_extensions: | ||
sonarqube_logs: | ||
sonarqube_temp: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM openjdk:8-alpine | ||
|
||
ARG RELEASE=4.0.0.1744 | ||
|
||
RUN apk add --no-cache curl grep sed unzip bash nodejs nodejs-npm | ||
|
||
RUN npm install -g typescript | ||
ENV NODE_PATH "/usr/lib/node_modules/" | ||
|
||
# Set timezone to CST | ||
ENV TZ=Europe/Warsaw | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
WORKDIR /usr/src | ||
|
||
RUN curl --insecure -o ./sonarscanner.zip -L https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$RELEASE-linux.zip && \ | ||
unzip sonarscanner.zip && \ | ||
rm sonarscanner.zip && \ | ||
mv sonar-scanner-$RELEASE-linux /usr/lib/sonar-scanner && \ | ||
ln -s /usr/lib/sonar-scanner/bin/sonar-scanner /usr/local/bin/sonar-scanner | ||
|
||
ENV SONAR_RUNNER_HOME=/usr/lib/sonar-scanner | ||
|
||
# ensure Sonar uses the provided Java for musl instead of a borked glibc one | ||
RUN sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /usr/lib/sonar-scanner/bin/sonar-scanner | ||
|
||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait | ||
RUN chmod +x /wait |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#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/sonarqube | ||
|
||
#----- Default source code encoding | ||
# sonar.sourceEncoding=UTF-8 | ||
|
||
#----- Global database settings (not used for SonarQube 5.2+) | ||
sonar.jdbc.username=sonar | ||
sonar.jdbc.password=sonar | ||
|
||
# H2 database from Docker Sonar container | ||
sonar.jdbc.url=jdbc:h2:tcp://localhost:9092/sonar | ||
sonar.projectKey=nest-typescript-starter | ||
sonar.projectName=nest-typescript-starter | ||
sonar.projectVersion=1 | ||
sonar.projectBaseDir=/usr/src | ||
sonar.sources=src | ||
sonar.exclusions=**/*.spec.ts | ||
sonar.tests.inclusions=**/*.spec.ts | ||
sonar.javascript.lcov.reportPaths=coverage/lcov.info | ||
sonar.typescript.lcov.reportPaths=coverage/lcov.info | ||
|
||
# Exclude node_modules for JS/TS-based scanning - this is provided in default configuration from | ||
# the server, but in case you want to provide it locally and/or override it here: | ||
sonar.exclusions=**/node_modules/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A docker-compose generated container name would be more preferable in my opinion than a fixed name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was set by mean to link with
sonarscanner
. Now, we can expose one more port for TCP connection. And omit this container_name.