even more changes to the Dockerfile

This commit is contained in:
2025-08-15 08:31:06 +02:00
parent fd5fe86810
commit 4a654a4cf7

View File

@@ -1,24 +1,25 @@
# Base image for runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
# Build stage for ASP.NET Core
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["YatzyGame/YatzyGame.csproj", "./YatzyGame/"]
RUN dotnet restore "./YatzyGame/YatzyGame.csproj"
COPY ["YatzyGame/YatzyGame.csproj", "YatzyGame/"]
COPY ["YatzyLibrary/YatzyLibrary.csproj", "YatzyLibrary/"]
RUN dotnet restore "YatzyGame/YatzyGame.csproj"
COPY . .
WORKDIR "/src"
RUN dotnet build "./YatzyGame/YatzyGame.csproj" -c $BUILD_CONFIGURATION -o /app/build
WORKDIR "/src/YatzyGame"
RUN dotnet build "YatzyGame.csproj" -c $BUILD_CONFIGURATION -o /app/build
# Publish ASP.NET Core app
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./YatzyGame/YatzyGame.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
RUN dotnet publish "YatzyGame.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# Final runtime stage
FROM base AS final