FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
WORKDIR /app
EXPOSE 5000

FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY ["src/EntKube.Web/EntKube.Web.csproj", "src/EntKube.Web/"]
COPY ["src/EntKube.Web.Client/EntKube.Web.Client.csproj", "src/EntKube.Web.Client/"]
COPY ["src/EntKube.SharedKernel/EntKube.SharedKernel.csproj", "src/EntKube.SharedKernel/"]
RUN dotnet restore "src/EntKube.Web/EntKube.Web.csproj"
COPY . .
WORKDIR "/src/src/EntKube.Web"
RUN dotnet build -c Release -o /app/build

FROM build AS publish
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENV ASPNETCORE_URLS=http://+:5000
ENTRYPOINT ["dotnet", "EntKube.Web.dll"]
