【问题标题】:How to run a SonarQube analysis of .NET Core solution in a Linux container?如何在 Linux 容器中运行 .NET Core 解决方案的 SonarQube 分析?
【发布时间】:2018-12-04 20:54:32
【问题描述】:

我想在 Linux 容器中使用 their new support 为 dotnet 全局工具运行 SonarQube 分析。我想知道在这种情况下配置(服务器 URL、用户凭据)在哪里?

【问题讨论】:

    标签: docker .net-core sonarqube


    【解决方案1】:

    这很适合我:

    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 文件的上下文中构建。

    【讨论】:

    • 如果您在命令中传入设置,它也可以工作。在图像中正确安装 java 是我所缺少的。
    猜你喜欢
    • 1970-01-01
    • 2016-10-16
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 2017-10-22
    • 1970-01-01
    • 2018-07-30
    • 2016-10-24
    相关资源
    最近更新 更多