66 lines
3.2 KiB
Docker
66 lines
3.2 KiB
Docker
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
WORKDIR /app
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
WORKDIR /src
|
|
|
|
COPY ["CRIF.ACTion/CRIF.ACTion.csproj", "CRIF.ACTion/"]
|
|
COPY ["CRIF.ACTion.Tests/CRIF.ACTion.Tests.csproj", "CRIF.ACTion.Tests/"]
|
|
COPY ["Landmark.OLA.Application/Landmark.OLA.Application.csproj", "Landmark.OLA.Application/"]
|
|
COPY ["Landmark.OLA.Integration.Tests/Landmark.OLA.Integration.Tests.csproj", "Landmark.OLA.Integration.Tests/"]
|
|
COPY ["Landmark.OLA.Models/Landmark.OLA.Models.csproj", "Landmark.OLA.Models/"]
|
|
COPY ["Landmark.OLA.Tests/Landmark.OLA.Tests.csproj", "Landmark.OLA.Tests/"]
|
|
COPY ["OnlineBankingAuth/OnlineBankingAuth.csproj", "OnlineBankingAuth/"]
|
|
COPY ["OnlineBankingAuth.Tests/OnlineBankingAuth.Tests.csproj", "OnlineBankingAuth.Tests/"]
|
|
COPY ["USPS/USPS.csproj", "USPS/"]
|
|
COPY ["USPS.Tests/USPS.Tests.csproj", "USPS.Tests/"]
|
|
|
|
# Install Credential Provider and set env variables to enable Nuget restore with auth
|
|
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && \
|
|
update-ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Download the NuGet Credential Provider directly (Docker's ADD uses trusted TLS)
|
|
ADD https://github.com/microsoft/artifacts-credprovider/releases/latest/download/Microsoft.Net6.NuGet.CredentialProvider.tar.gz /tmp/
|
|
|
|
# Extract and install Credential Provider
|
|
RUN mkdir -p /root/.nuget/plugins/netcore && \
|
|
tar --strip-components=3 -xzf /tmp/Microsoft.Net6.NuGet.CredentialProvider.tar.gz -C /root/.nuget/plugins/netcore && \
|
|
rm /tmp/Microsoft.Net6.NuGet.CredentialProvider.tar.gz
|
|
|
|
ENV NUGET_PLUGIN_PATHS=/root/.nuget/plugins/netcore/CredentialProvider.Microsoft.dll
|
|
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED=true
|
|
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS="{\"endpointCredentials\": [{\"endpoint\":\"https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json\", \"password\":\"${PAT}\"}]}"
|
|
|
|
RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" "Landmark.OLA.Application/Landmark.OLA.Application.csproj"
|
|
|
|
COPY ["CRIF.ACTion/", "CRIF.ACTion/"]
|
|
COPY ["CRIF.ACTion.Tests/", "CRIF.ACTion.Tests/"]
|
|
COPY ["Landmark.OLA.Application/", "Landmark.OLA.Application/"]
|
|
COPY ["Landmark.OLA.Integration.Tests/", "Landmark.OLA.Integration.Tests/"]
|
|
COPY ["Landmark.OLA.Models/", "Landmark.OLA.Models/"]
|
|
COPY ["Landmark.OLA.Tests/", "Landmark.OLA.Tests/"]
|
|
COPY ["OnlineBankingAuth/", "OnlineBankingAuth/"]
|
|
COPY ["OnlineBankingAuth.Tests/", "OnlineBankingAuth.Tests/"]
|
|
COPY ["USPS/", "USPS/"]
|
|
COPY ["USPS.Tests/", "USPS.Tests/"]
|
|
|
|
RUN dotnet build "Landmark.OLA.Application/Landmark.OLA.Application.csproj"
|
|
|
|
FROM build AS test
|
|
WORKDIR /src
|
|
LABEL test=true
|
|
RUN dotnet test -c Release --results-directory /app/test --logger "trx;LogFileName=test.trx"
|
|
|
|
FROM build AS publish
|
|
WORKDIR /src
|
|
RUN dotnet publish "Landmark.OLA.Application/Landmark.OLA.Application.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
|
ENV ASPNETCORE_ENVIRONMENT=Development
|
|
|
|
FROM base AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
ENTRYPOINT ["dotnet", "Landmark.OLA.Application.dll"]
|