|
|
|
@ -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"]
|