fix .net docker build

This commit is contained in:
alyssa 2025-05-18 13:19:20 +00:00
parent 0fa0070d41
commit e573e978da
5 changed files with 13 additions and 2 deletions

29
ci/Dockerfile.dotnet Normal file
View file

@ -0,0 +1,29 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
# Restore/fetch dependencies excluding app code to make use of caching
COPY PluralKit.sln /app/
COPY Myriad/Myriad.csproj /app/Myriad/
COPY PluralKit.API/PluralKit.API.csproj /app/PluralKit.API/
COPY PluralKit.Bot/PluralKit.Bot.csproj /app/PluralKit.Bot/
COPY PluralKit.Core/PluralKit.Core.csproj /app/PluralKit.Core/
COPY PluralKit.Tests/PluralKit.Tests.csproj /app/PluralKit.Tests/
COPY .git/ /app/.git
COPY Serilog/ /app/Serilog/
RUN dotnet restore PluralKit.sln
# Copy the rest of the code and build
COPY . /app
RUN dotnet build -c Release -o bin
# Build runtime stage (doesn't include SDK)
FROM mcr.microsoft.com/dotnet/aspnet:8.0
LABEL org.opencontainers.image.source = "https://github.com/PluralKit/PluralKit"
WORKDIR /app
COPY --from=build /app ./
# Allow overriding CMD from eg. docker-compose to run API layer too
ENTRYPOINT ["dotnet"]
CMD ["bin/PluralKit.Bot.dll"]