如何在Linux容器中运行.NET Core解决方案的SonarQube分析? [英] How to run a SonarQube analysis of .NET Core solution in a Linux container?
本文介绍了如何在Linux容器中运行.NET Core解决方案的SonarQube分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用他们的新支持在Linux容器中运行SonarQube分析。适用于dotnet全局工具。我不知道在这种情况下配置(服务器URL,用户凭据)在哪里?
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?
推荐答案
这对我来说很好: / p>
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
显然,它需要在存在 SonarQube.Analysis.xml
文件的环境中进行构建。
Obviously, it needs to be build in a context with SonarQube.Analysis.xml
file present.
这篇关于如何在Linux容器中运行.NET Core解决方案的SonarQube分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文