Revert Dockerfile to multi-stage build

Signed-off-by: Ske <voltasalt@gmail.com>
This commit is contained in:
Ske 2021-06-09 12:47:26 +02:00
parent 08a863d411
commit 6a3d9b9426

View File

@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0 FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /app WORKDIR /app
# Restore/fetch dependencies excluding app code to make use of caching # Restore/fetch dependencies excluding app code to make use of caching
@ -14,7 +14,11 @@ RUN dotnet restore PluralKit.sln
COPY . /app COPY . /app
RUN dotnet build -c Release -o bin RUN dotnet build -c Release -o bin
# Run :) # Build runtime stage (doesn't include SDK)
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build /app ./
# Allow overriding CMD from eg. docker-compose to run API layer too # Allow overriding CMD from eg. docker-compose to run API layer too
ENTRYPOINT ["dotnet"] ENTRYPOINT ["dotnet"]
CMD ["bin/PluralKit.Bot.dll"] CMD ["bin/PluralKit.Bot.dll"]