Sonar scanner docker image
# Configuration to react project created with create-react-app
sonar.projectKey=br.com.clairtonluz:example
sonar.projectName=Example
sonar.projectVersion=1.0
sonar.sources=src
sonar.tests=src
sonar.test.inclusions=src/**/*.test.ts,src/**/*.test.tsx,src/**/*.spec.js,src/**/*.spec.jsx,src/**/*.test.js,src/**/*.test.jsx
# If your project use javascript instead of typescript change "sonar.typescript.lcov.repostPaths" to "sonar.javascript.lcov.repostPaths"
sonar.typescript.lcov.reportPaths=coverage/lcov.info
sonar.sourceEncoding=UTF-8
sonar.exclusions=**/node_modules/**, build/**
docker run -e SONAR_HOST_URL=<YOUR_SONAR_HOST_URL> \
-e SONAR_TOKEN=<YOUR_SONAR_TOKEN> \
--entrypoint=/bin/bash \
-it -v "/path/to/your/project:/usr/src" \
clairtonluz/sonar-scanner-cli
docker run -e SONAR_HOST_URL=<YOUR_SONAR_HOST_URL> \
-e SONAR_TOKEN=<YOUR_SONAR_TOKEN> \
--entrypoint=/bin/bash \
-it -v "/path/to/your/project:/usr/src" \
clairtonluz/sonar-scanner-cli
# Into image docker run this to generate coverage
npx react-scripts test --coverage --coverageReporters=lcov --env=jsdom --watchAll=false
# send coverage to sonar
sonar-scanner
test:
image: sonarsource/sonar-scanner-cli
variables:
SONAR_HOST_URL: <your_sonar_url_here>
SONAR_TOKEN: <your_token_here>
script:
- npm install
- npx react-scripts test --coverage --coverageReporters=lcov --env=jsdom --watchAll=false
- sonar-scanner -Dsonar.projectKey="$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME" -Dsonar.projectName="$CI_PROJECT_TITLE"
Content type
Image
Digest
Size
133.4 MB
Last updated
almost 7 years ago
docker pull clairtonluz/sonar-scanner