You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
2.0 KiB
48 lines
2.0 KiB
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
USER $APP_UID
|
|
RUN echo $APP_UID
|
|
RUN whomi
|
|
WORKDIR /app
|
|
EXPOSE 8080
|
|
EXPOSE 8081
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
ARG BUILD_CONFIGURATION=Release
|
|
WORKDIR /src
|
|
COPY ["HeartTrackAPI/HeartTrackAPI.csproj", "HeartTrackAPI/"]
|
|
COPY ["StubbedContextLib/StubbedContextLib.csproj", "StubbedContextLib/"]
|
|
COPY ["Shared/Shared.csproj", "Shared/"]
|
|
COPY ["Entities/Entities.csproj", "Entities/"]
|
|
COPY ["Dto/Dto.csproj", "Dto/"]
|
|
COPY ["APIMappers/APIMappers.csproj", "APIMappers/"]
|
|
COPY ["EFMappers/EFMappers.csproj", "EFMappers/"]
|
|
COPY ["DbContextLib/DbContextLib.csproj", "DbContextLib/"]
|
|
COPY ["Model/Model.csproj", "Model/"]
|
|
COPY ["Model2Entities/Model2Entities.csproj", "Model2Entities/"]
|
|
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
|
|
|
|
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
|
|
RUN chmod 777 HeartTrackAPI/uca.HeartTrack.db
|
|
|
|
WORKDIR "/src/HeartTrackAPI"
|
|
RUN dotnet build "HeartTrackAPI.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
|
|
|
FROM build AS publish
|
|
ARG BUILD_CONFIGURATION=Release
|
|
RUN dotnet publish "HeartTrackAPI.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
|
|
|
FROM base AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
COPY --from=publish /src/HeartTrackAPI/uca.HeartTrack.db .
|
|
RUN ls -l uca.HeartTrack.db
|
|
|
|
ENTRYPOINT ["dotnet", "HeartTrackAPI.dll"] |