From 6c6ee710923af74a765b9f948bc2bb3dee6836c1 Mon Sep 17 00:00:00 2001 From: Noan RANDON Date: Wed, 1 Mar 2023 13:07:03 +0100 Subject: [PATCH] :chart_with_upwards_trend: DockerFile --- code/Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/Dockerfile b/code/Dockerfile index 4e3d8e9..4a95db0 100644 --- a/code/Dockerfile +++ b/code/Dockerfile @@ -1,5 +1,6 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build1 WORKDIR /app/server +RUN dotnet new console COPY server/Server/Program.cs Program.cs RUN dotnet publish -c Release -o out @@ -11,14 +12,17 @@ COPY ["server/DataBase/DataBase.csproj", "DataBase/"] RUN dotnet restore "ApiLeapHit/ApiLeapHit.csproj" COPY . . WORKDIR "/app/api/ApiLeapHit" -RUN dotnet build "ApiLeapHit.csproj" -c Release -o /app/api/build +RUN dotnet build2 "ApiLeapHit.csproj" -c Release -o /app/api/build + +FROM build2 AS publish +RUN dotnet publish "ApiLeapHit.csproj" -c Release -o /app/publish FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -COPY --from=build1 /app/server/out . -COPY --from=build2 /app/api/build . +COPY --from=build1 /app/server/build . +COPY --from=publish /app/api/publish . ENTRYPOINT ["dotnet", "ApiLeapHit.dll"] \ No newline at end of file