diff --git a/code/Dockerfile b/code/Dockerfile index 7a5a754..1285831 100644 --- a/code/Dockerfile +++ b/code/Dockerfile @@ -1,12 +1,30 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build -WORKDIR /app + +# Première étape de la construction +WORKDIR /app/server RUN dotnet new console -COPY server/Server/Program.cs Program.cs +COPY Server/Program.cs Program.cs RUN dotnet publish -c Release -o out -FROM mcr.microsoft.com/dotnet/runtime:6.0 +# Deuxième étape de la construction +WORKDIR /app/api +COPY ApiLeapHit/ApiLeapHit.csproj . +COPY DTO/DTO.csproj DTO/ +COPY DataBase/DataBase.csproj DataBase/ +RUN dotnet restore +COPY . . +WORKDIR /app/api/ApiLeapHit +RUN dotnet build -c Release -o /app/build + +# Troisième étape de la construction +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS final WORKDIR /app -COPY --from=build /app/out . -ENTRYPOINT ["dotnet", "app.dll"] +COPY --from=build /app/server/out . +COPY --from=build /app/api/build . +# Configuration de l'application +EXPOSE 80 +EXPOSE 443 EXPOSE 3131 +ENTRYPOINT ["dotnet", "ApiLeapHit.dll"] +