From 3ca3f2e9ff523decd59f462aea034a3f6263d3cf Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 14 Mar 2024 22:18:59 +0100 Subject: [PATCH] :arrow_up: again boy --- src/HeartTrackAPI/Dockerfile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/HeartTrackAPI/Dockerfile b/src/HeartTrackAPI/Dockerfile index 8656c8e..7bc5a42 100644 --- a/src/HeartTrackAPI/Dockerfile +++ b/src/HeartTrackAPI/Dockerfile @@ -21,9 +21,15 @@ COPY ["StubAPI/StubAPI.csproj", "StubAPI/"] COPY ["StubbedContextLib/StubbedContextLib.csproj", "StubbedContextLib/"] RUN dotnet restore "HeartTrackAPI/HeartTrackAPI.csproj" COPY . . +RUN dotnet tool install --global dotnet-ef --version 8.0 -WORKDIR "/src/HeartTrackAPI" +ENV PATH="${PATH}:/root/.dotnet/tools" +# Add the migrations +RUN dotnet-ef migrations add --project StubbedContextLib/StubbedContextLib.csproj --startup-project HeartTrackAPI/HeartTrackAPI.csproj --context StubbedContextLib.TrainingStubbedContext --configuration Debug Initial +# Update the database +RUN dotnet-ef database update --project StubbedContextLib/StubbedContextLib.csproj --startup-project HeartTrackAPI/HeartTrackAPI.csproj --context StubbedContextLib.TrainingStubbedContext --configuration Debug +WORKDIR "/src/HeartTrackAPI" RUN dotnet build "HeartTrackAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build FROM build AS publish @@ -32,13 +38,5 @@ RUN dotnet publish "HeartTrackAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publis FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -RUN dotnet tool install --global dotnet-ef --version 8.0 - -ENV PATH="${PATH}:/root/.dotnet/tools" -# Add the migrations -RUN dotnet-ef migrations add --project StubbedContextLib/StubbedContextLib.csproj --startup-project HeartTrackAPI/HeartTrackAPI.csproj --context StubbedContextLib.TrainingStubbedContext --configuration Debug Initial -# Update the database -RUN dotnet-ef database update --project StubbedContextLib/StubbedContextLib.csproj --startup-project HeartTrackAPI/HeartTrackAPI.csproj --context StubbedContextLib.TrainingStubbedContext --configuration Debug - -# COPY --from=publish /src/HeartTrackAPI/uca.HeartTrack.db . +COPY --from=publish /src/HeartTrackAPI/uca.HeartTrack.db . ENTRYPOINT ["dotnet", "HeartTrackAPI.dll"] \ No newline at end of file