FROM mcr.microsoft.com/dotnet/sdk:10.0.403 AS build
WORKDIR /src
COPY global.json ./
COPY Server/ Server/
RUN dotnet restore Server/Lab.Server.csproj --source https://api.nuget.org/v3/index.json
RUN dotnet publish Server/Lab.Server.csproj --no-restore -c Release -o /out
FROM mcr.microsoft.com/dotnet/aspnet:10.0.14
WORKDIR /app
COPY --from=build /out/ ./
ENV ASPNETCORE_URLS=http://+:8080
ENV Lab__LedgerPath=/tmp/classroom-ledger.db
USER $APP_UID
EXPOSE 8080
ENTRYPOINT ["dotnet", "Lab.Server.dll"]
