问题
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