This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
generated from LBHackney-IT/lbh-base-listener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (27 loc) · 1.44 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FROM mcr.microsoft.com/dotnet/sdk:6.0
# disable microsoft telematry
ENV DOTNET_CLI_TELEMETRY_OPTOUT='true'
ENV DynamoDb_LocalMode='true'
ARG LBHPACKAGESTOKEN
ENV LBHPACKAGESTOKEN=$LBHPACKAGESTOKEN
ARG SONAR_TOKEN
ENV SONAR_TOKEN=$SONAR_TOKEN
WORKDIR /app
# Enable SonarCloud
RUN apt-get update && apt-get install -y openjdk-11-jdk
RUN dotnet tool install --global dotnet-sonarscanner
ENV PATH="$PATH:/root/.dotnet/tools"
RUN dotnet sonarscanner begin /k:"LBHackney-IT_financial-transaction-listener" /o:"lbhackney-it" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login="${SONAR_TOKEN}"
# Copy csproj and restore as distinct layers
COPY ./FinancialTransactionListener.sln ./
COPY ./FinancialTransactionListener/FinancialTransactionListener.csproj ./FinancialTransactionListener/
COPY ./FinancialTransactionListener.Tests/FinancialTransactionListener.Tests.csproj ./FinancialTransactionListener.Tests/
COPY /NuGet.Config /root/.nuget/NuGet/NuGet.Config
RUN dotnet restore ./FinancialTransactionListener/FinancialTransactionListener.csproj
RUN dotnet restore ./FinancialTransactionListener.Tests/FinancialTransactionListener.Tests.csproj
# Copy everything else and build
COPY . .
RUN dotnet build -c debug -o out FinancialTransactionListener/FinancialTransactionListener.csproj
RUN dotnet build -c debug -o out FinancialTransactionListener.Tests/FinancialTransactionListener.Tests.csproj
CMD dotnet test
RUN dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}"