50 lines
1.9 KiB
Docker
50 lines
1.9 KiB
Docker
# .NET Core SDK
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy Projects
|
|
COPY LCU.Api.Internal.MaidBotApi/LCU.Api.Internal.MaidBotApi.csproj LCU.Api.Internal.MaidBotApi/
|
|
COPY LCU.Api.Internal.MaidBotLib/LCU.Api.Internal.MaidBotLib.csproj LCU.Api.Internal.MaidBotLib/
|
|
|
|
# Configure NuGet auth for the Azure DevOps feed during restore.
|
|
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
|
RUN mkdir -p /root/.nuget/NuGet && \
|
|
printf '%s\n' \
|
|
'<?xml version="1.0" encoding="utf-8"?>' \
|
|
'<configuration>' \
|
|
' <packageSources>' \
|
|
' <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />' \
|
|
' <add key="LCU-Internal" value="https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" />' \
|
|
' </packageSources>' \
|
|
' <packageSourceCredentials>' \
|
|
' <LCU-Internal>' \
|
|
' <add key="Username" value="AzureDevOps" />' \
|
|
' <add key="ClearTextPassword" value="'"${PAT}"'" />' \
|
|
' </LCU-Internal>' \
|
|
' </packageSourceCredentials>' \
|
|
'</configuration>' \
|
|
> /root/.nuget/NuGet/NuGet.Config
|
|
RUN dotnet restore LCU.Api.Internal.MaidBotApi/LCU.Api.Internal.MaidBotApi.csproj
|
|
|
|
# Copy All Files
|
|
COPY . .
|
|
|
|
FROM build AS test
|
|
LABEL test=true
|
|
RUN dotnet test -c Release --results-directory /testresults --logger "trx;LogFileName=test_results.trx" LCU.Api.Internal.MaidBotTests/LCU.Api.Internal.MaidBotTests.csproj
|
|
|
|
# .NET Core Publish
|
|
FROM build AS publish
|
|
RUN dotnet publish LCU.Api.Internal.MaidBotApi/LCU.Api.Internal.MaidBotApi.csproj -c Release -o /app/publish
|
|
|
|
# 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 /app/publish .
|
|
ENTRYPOINT ["dotnet", "LCU.Api.Internal.MaidBotApi.dll"]
|