Files
monorepo/LCU.API.Internal.Dispatcher/Dockerfile
T
2026-03-24 15:26:03 -05:00

43 lines
2.4 KiB
Docker

# .NET Core SDK
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS aspnetcore-build
# Copy Projects
COPY LCU.Api.Internal.Dispatcher/LCU.Api.Internal.Dispatcher.csproj ./source/LCU.Api.Internal.Dispatcher/
COPY LCU.Api.Internal.DispatcherLib/LCU.Api.Internal.DispatcherLib.csproj ./source/LCU.Api.Internal.DispatcherLib/
COPY LCU.Api.Internal.DispatcherSharedLib/LCU.Api.Internal.DispatcherSharedLib.csproj ./source/LCU.Api.Internal.DispatcherSharedLib/
COPY LCU.Library.Internal.DispatcherModels/LCU.Library.Internal.DispatcherModels.csproj ./source/LCU.Library.Internal.DispatcherModels/
# 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
#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}\"}]}"
# .NET Core Restore, use auth'd feed
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.Dispatcher/LCU.Api.Internal.Dispatcher.csproj
# Copy All Files
COPY . ./source/
FROM aspnetcore-build AS test
LABEL test=true
COPY LCU.Api.Internal.DispatcherTests/LCU.Api.Internal.DispatcherTests.csproj ./source/LCU.Api.Internal.DispatcherTests/
RUN dotnet restore ./source/LCU.Api.Internal.DispatcherTests/LCU.Api.Internal.DispatcherTests.csproj
RUN dotnet test -c Release --results-directory /testresults --logger "trx;LogFileName=test_results.trx" ./source/LCU.Api.Internal.DispatcherTests/LCU.Api.Internal.DispatcherTests.csproj
# .NET Core Publish
FROM aspnetcore-build as publish
RUN dotnet publish ./source/LCU.Api.Internal.Dispatcher/LCU.Api.Internal.Dispatcher.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 TZ America/Chicago
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV ASPNETCORE_ENVIRONMENT=Development
WORKDIR /app
COPY --from=publish /dist .
ENTRYPOINT ["dotnet", "LCU.Api.Internal.Dispatcher.dll"]