45 lines
3.0 KiB
Docker
45 lines
3.0 KiB
Docker
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
|
|
|
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 ["LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj", "LCU.Api.Internal.CoreApiWrapper/"]
|
|
COPY ["LCU.Library.Internal.CoreApiWrapperLib/LCU.Library.Internal.CoreApiWrapperLib.csproj", "LCU.Library.Internal.CoreApiWrapperLib/"]
|
|
COPY ["LCU.Library.Internal.CoreApiWrapperModel/LCU.Library.Internal.CoreApiWrapperModel.csproj", "LCU.Library.Internal.CoreApiWrapperModel/"]
|
|
COPY ["LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj", "LCU.Api.Internal.CoreApiWrapperTest/"]
|
|
|
|
# Install Credential Provider and set environment variables to enable authenticated Nuget restore
|
|
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
|
RUN curl -L https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | sh
|
|
#RUN wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
|
|
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" "LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj"
|
|
RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" "LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj"
|
|
|
|
COPY ["LCU.Api.Internal.CoreApiWrapper/", "LCU.Api.Internal.CoreApiWrapper/"]
|
|
COPY ["LCU.Library.Internal.CoreApiWrapperLib/", "LCU.Library.Internal.CoreApiWrapperLib/"]
|
|
COPY ["LCU.Library.Internal.CoreApiWrapperModel/", "LCU.Library.Internal.CoreApiWrapperModel/"]
|
|
COPY ["LCU.Api.Internal.CoreApiWrapperTest/", "LCU.Api.Internal.CoreApiWrapperTest/"]
|
|
|
|
RUN dotnet build "LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj" -c Release -o /app/build
|
|
|
|
FROM build AS test
|
|
WORKDIR /src
|
|
LABEL test=true
|
|
RUN dotnet test -c Release --results-directory /app/test --logger "trx;LogFileName=test.trx" "LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj"
|
|
|
|
FROM build AS publish
|
|
WORKDIR /src
|
|
RUN dotnet publish "LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.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", "LCU.Api.Internal.CoreApiWrapper.dll"] |