SonarQube
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.dotnet/tools
RUN curl -sSL https://deb.nodesource.com/setup_18.x | /bin/bash \
&& apt-get update \
&& apt-get install -y \
openjdk-17-jre-headless \
nodejs \
&& dotnet tool install --global dotnet-sonarscanner
WORKDIR /src
ARG BRANCH_NAME=no_branch_name_specified
COPY ["Coral.API/Coral.API.csproj", "Coral.API/Coral.API.csproj"]
COPY ["Coral.Application/Coral.Application.csproj", "Coral.Application/Coral.Application.csproj"]
COPY ["Coral.Configuration/Coral.Configuration.csproj", "Coral.Configuration/Coral.Configuration.csproj"]
COPY ["Coral.Core/Coral - Backup.Entities.csproj", "Coral.Core/Coral - Backup.Entities.csproj"]
COPY ["Coral.Core/Coral.Core.csproj", "Coral.Core/Coral.Core.csproj"]
COPY ["Coral.Infrastructure/Coral.Infrastructure.csproj", "Coral.Infrastructure/Coral.Infrastructure.csproj"]
COPY ["Coral.IdentityServer/Coral.IdentityServer.csproj", "Coral.IdentityServer/Coral.IdentityServer.csproj"]
COPY ["Coral.sln", "Coral.sln"]
COPY ["Coral.Lambda/src/Coral.Lambda/Coral.Lambda.csproj", "Coral.Lambda/src/Coral.Lambda/Coral.Lambda.csproj"]
COPY ["Coral.Lambda/test/Coral.Lambda.Tests/Coral.Lambda.Tests.csproj", "Coral.LambdaC/test/Coral.Lambda.Tests/Coral.Lambda.Tests.csproj"]
COPY ["Coral.Test/Coral.Test.csproj", "Coral.Test/Coral.Test.csproj"]
RUN dotnet restore --disable-parallel
COPY . ./
WORKDIR /src/Coral.API
#RUN msbuild "Coral.API.csproj"
#/p:Configuration=Release
# Sonarqube analysis
RUN dotnet sonarscanner begin /k:"Coral.API" \
/d:sonar.host.url="https://sonarqube.dev.governmentbrands.com/sonarqube" \
/d:sonar.login="squ_500145d5074ffd1c2505927d692ed5eb1cc3dbb0"
RUN dotnet build Coral.API.csproj
##/p:Configuration=Release
RUN dotnet sonarscanner end /d:sonar.login="squ_500145d5074ffd1c2505927d692ed5eb1cc3dbb0"
#RUN msbuild "Coral.API.csproj" /p:Configuration=Release
RUN dotnet publish "Coral.API.csproj" -c Release -o /app -p:PublishReadyToRun=true
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS runtime
EXPOSE 5000
RUN apt-get update && apt-get install -y vim procps
WORKDIR /app
COPY --from=builder /app .
RUN groupadd --gid 1000 app \
&& useradd --uid 1000 --gid app --shell /bin/bash --create-home app
RUN chown -R app:app /app
USER app
ENTRYPOINT ["./Coral.API", "--urls=http://0.0.0.0:5000"]
Docker file with openjdk-17-jre-headless
upgrade and SonarQube Analysis:
# Sonarqube analysis
RUN dotnet sonarscanner begin /k:"Coral.API" \
/d:sonar.host.url="https://sonarqube.dev.governmentbrands.com/sonarqube" \
/d:sonar.login="squ_500145d5074ffd1c2505927d692ed5eb1cc3dbb0"
RUN dotnet build Coral.API.csproj
##/p:Configuration=Release
RUN dotnet sonarscanner end /d:sonar.login="squ_500145d5074ffd1c2505927d692ed5eb1cc3dbb0"
, multiple selections available,
Related content
Coral Automation Framework
Coral Automation Framework
More like this
Redaction API Flow
Redaction API Flow
More like this