38 lines
2.3 KiB
Docker
38 lines
2.3 KiB
Docker
# .NET Core SDK
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS aspnetcore-build
|
|
|
|
# Copy Projects
|
|
COPY LCU.API.Internal.MemberPreferencesApi/LCU.API.Internal.MemberPreferencesApi.csproj ./source/LCU.API.Internal.MemberPreferencesApi/
|
|
COPY LCU.API.Internal.MemberPreferencesApiLib/LCU.API.Internal.MemberPreferencesApiLib.csproj ./source/LCU.API.Internal.MemberPreferencesApiLib/
|
|
COPY LCU.Library.Internal.MemberPreferencesApiModels/LCU.Library.Internal.MemberPreferencesApiModels.csproj ./source/LCU.Library.Internal.MemberPreferencesApiModels/
|
|
|
|
# Install Credential Provider and set env variables to enable Nuget restore with auth
|
|
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
|
RUN curl -L https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | sh
|
|
|
|
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" ./source/LCU.API.Internal.MemberPreferencesApi/LCU.API.Internal.MemberPreferencesApi.csproj
|
|
|
|
# Copy All Files
|
|
COPY . ./source/
|
|
|
|
LABEL test=true
|
|
COPY LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/
|
|
RUN dotnet restore ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj
|
|
RUN dotnet test -c Release --results-directory /testresults --logger "trx;LogFileName=test_results.trx" ./source/LCU.API.Internal.MemberPreferencesApi.UnitTests/LCU.API.Internal.MemberPreferencesApi.UnitTests.csproj
|
|
|
|
# .NET Core Publish
|
|
RUN dotnet publish ./source/LCU.API.Internal.MemberPreferencesApi/LCU.API.Internal.MemberPreferencesApi.csproj -c Release -o /dist
|
|
|
|
# ASP.NET Core
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine3.20
|
|
RUN apk add --no-cache icu-libs && apk add --no-cache tzdata;
|
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
|
ENV ASPNETCORE_ENVIRONMENT=Development
|
|
|
|
WORKDIR /app
|
|
COPY --from=aspnetcore-build /dist .
|
|
ENTRYPOINT ["dotnet", "LCU.API.Internal.MemberPreferencesApi.dll"]
|