.NET scan inside the Docker container

Hi Pawel, welcome to the community :slight_smile:

It is possible to run SonarScanner for .NET directly on your Docker Container during the build, just use the commands described here in your dockerfile. I don’t think SonarQubePrepare/Analyze/Publish tasks are needed in this situation. The downside of this approach is that you will also need to install the Java prerequisite on your container which you may find undesirable! I am currently exploring ways to improve this experience.

Should you even care? This is an interesting question - I think it is very unlikely that you will see any differences in the results as long as the build parameters are the same. Although you are effectively building twice, your original approach has the advantage that you can run the creation of the docker container and the analysis in parallel which may reduce your overall build time.

I hope that is helpful, please let me know if you have any further questions.

Tom

2 Likes