﻿FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 80


FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["*.props", "/"]
COPY ["PTA.DataCloud.Security/", "PTA.DataCloud.Security/"]
COPY ["PTA.DataCloud.ServiceDefaults/", "PTA.DataCloud.ServiceDefaults/"]
COPY ["PTA.DataCloud.Shared/", "PTA.DataCloud.Shared/"]
RUN dotnet nuget add source https://nuget.ptabusiness.com/api/packages/protech/nuget/index.json -n gitea -u developer -p !Pr0t3ch# --store-password-in-clear-text
RUN dotnet build "PTA.DataCloud.Security/PTA.DataCloud.Security.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "PTA.DataCloud.Security/PTA.DataCloud.Security.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PTA.DataCloud.Security.dll"]
