Partial Scan with SonarScanner within the Dockerfile for a mono repo

I am trying to use SonarScanner within the Dockerfile.
I do have multiple docker files, each is responsible for part of the solution and APIs and some also contains some tests.
Every time I do a scan within the Dockerfile, I see the analysis in the overview of the project in the SonarCloud.

The Issue is that every scan overrides the previous scan, which leads to have only part of the solution at a time in the Sonar Cloud.

Question: Is there any parameters which I can add to the scan to let SonarCloud identify that these scans should be covered all together, not replacing each other.

Workaround for me now is to have a huge docker file which includes all the projects and test to be scanned. Doing that will lead to have unnecessary scans for the code. It leads to have multiple times lines of codes scanned which is not good since the licenses are based on the lines of code we do scan.


Welcome to the community!

Yes, this is just the way it works.

You should either analyze all parts together / at once, or analyze each part with its own project id.


1 Like

thanks for the answer, even it didnt fix my issue :wink: .

That means that it will scan the codes over and over again even it was not changed or not needed to be scanned again.
It will then lead to pay a lot more for the license since we will scan the whole solution over and over again.


Hi Aidin,

Nope. You don’t use up your license by re-analzying the same lines of code. At any given time, your license usage is calculated by the total number of lines of code under analysis, not how many times those LOCs have been analyzed. The docs have more details.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.