How to run a SonarQube analysis of .NET Core solution in a Linux container?

*爱你&永不变心* 提交于 2019-12-22 13:48:16

问题


I would like to run SonarQube analysis in a Linux container using their new support for dotnet global tools. I wonder though where is configuration (server URL, user credentials) located in such case?


回答1:


This works for me nicely:

FROM microsoft/dotnet:2.1.300-sdk

RUN apt-get update && apt-get install -y openjdk-8-jre

RUN dotnet tool install --global dotnet-sonarscanner --version 4.3.1
COPY SonarQube.Analysis.xml /root/.dotnet/tools/.store/dotnet-sonarscanner/4.3.1/dotnet-sonarscanner/4.3.1/tools/netcoreapp2.1/any/SonarQube.Analysis.xml
ENV PATH="/root/.dotnet/tools:${PATH}"

RUN dotnet sonarscanner begin /k:project-key
RUN dotnet build
RUN dotnet sonarscanner end

Obviously, it needs to be build in a context with SonarQube.Analysis.xml file present.



来源:https://stackoverflow.com/questions/51037738/how-to-run-a-sonarqube-analysis-of-net-core-solution-in-a-linux-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!