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

COPY dotnet/dotnet.sln dotnet/dotnet.sln
COPY dotnet/AipsCore/AipsCore.csproj dotnet/AipsCore/
COPY dotnet/AipsWebApi/AipsWebApi.csproj dotnet/AipsWebApi/
COPY dotnet/AipsRT/AipsRT.csproj dotnet/AipsRT/
COPY dotnet/AipsWorker/AipsWorker.csproj dotnet/AipsWorker/

WORKDIR /src/dotnet
RUN dotnet restore dotnet.sln

WORKDIR /src
COPY dotnet/ dotnet/

WORKDIR /src/dotnet
RUN dotnet publish AipsWebApi/AipsWebApi.csproj -c Release -o /app/publish --no-restore

FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "AipsWebApi.dll"]
