#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Ropin.Environmentally.AlarmService/Ropin.Environmentally.AlarmService.csproj", "Ropin.Environmentally.AlarmService/"]
COPY ["Core.RabbitMQBus.Common/Core.RabbitMQBus.Common.csproj", "Core.RabbitMQBus.Common/"]
COPY ["Core.RabbitMQBus/Core.RabbitMQBus.csproj", "Core.RabbitMQBus/"]
COPY ["Ropin.Core.Common/Ropin.Core.Common.csproj", "Ropin.Core.Common/"]
COPY ["Ropin.Inspection.Common/Ropin.Inspection.Common.csproj", "Ropin.Inspection.Common/"]
COPY ["Ropin.Inspection.Model/Ropin.Inspection.Model.csproj", "Ropin.Inspection.Model/"]
COPY ["Ropin.Inspection.Repository/Ropin.Inspection.Repository.csproj", "Ropin.Inspection.Repository/"]
RUN dotnet restore "Ropin.Environmentally.AlarmService/Ropin.Environmentally.AlarmService.csproj"
COPY . .
WORKDIR "/src/Ropin.Environmentally.AlarmService"
RUN dotnet build "Ropin.Environmentally.AlarmService.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Ropin.Environmentally.AlarmService.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Ropin.Environmentally.AlarmService.dll"]