FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /app

COPY ["nuget.config", "./"]
COPY ["MidrandBookshop/MidrandBookshop.csproj", "MidrandBookshop/"]
RUN dotnet restore "MidrandBookshop/MidrandBookshop.csproj" --configfile nuget.config
COPY . .
RUN dotnet publish "MidrandBookshop/MidrandBookshop.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
WORKDIR /app

EXPOSE 8080
EXPOSE 8081

COPY --from=build /app/publish .

ENTRYPOINT ["dotnet", "MidrandBookshop.dll"]