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

# Copy solution + project files first
COPY CronApp.sln ./
COPY Scheduler/Scheduler.csproj Scheduler/

RUN dotnet restore CronApp.sln

# Copy the rest of the code
COPY . .

# Publish from the project folder
RUN dotnet publish Scheduler/Scheduler.csproj -c Release -o /app

FROM mcr.microsoft.com/dotnet/runtime:9.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Scheduler.dll"]
