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

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["datagrid-loop/datagrid-loop.csproj", "datagrid-loop/"]
RUN dotnet restore "datagrid-loop/datagrid-loop.csproj"
COPY . .
WORKDIR "/src/datagrid-loop"
RUN dotnet build "datagrid-loop.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "datagrid-loop.csproj" -c Release -o /app/publish

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