﻿# مرحله build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY . .
# Publish ONLY the API project: the build context contains the whole
# solution, and publishing the sln would dump every project's
# appsettings.json into /app (last one wins) — e.g. DataCopy's
# overwrote the API's and broke IppanelSms startup.
RUN dotnet restore GreenHome.Api/GreenHome.Api.csproj
RUN dotnet publish GreenHome.Api/GreenHome.Api.csproj -c Release -o /app
 
# مرحله runtime
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app
COPY --from=build /app .
EXPOSE 8080
ENTRYPOINT ["dotnet", "GreenHome.Api.dll"]
