如何在 Linux 容器中运行 .NET Core 解决方案的 SonarQube 分析? [英] How to run a SonarQube analysis of .NET Core solution in a Linux container?

查看:31
本文介绍了如何在 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?

推荐答案

这很适合我:

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆