FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
USER $APP_UID
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Directory.Build.props", "Directory.Packages.props", "./"]
COPY ["Tiku.Domain/Tiku.Domain.csproj", "Tiku.Domain/"]
COPY ["Tiku.Application/Tiku.Application.csproj", "Tiku.Application/"]
COPY ["Tiku.Infrastructure/Tiku.Infrastructure.csproj", "Tiku.Infrastructure/"]
COPY ["Tiku.Worker/Tiku.Worker.csproj", "Tiku.Worker/"]
RUN dotnet restore "Tiku.Worker/Tiku.Worker.csproj"
COPY . .
RUN dotnet publish "Tiku.Worker/Tiku.Worker.csproj" \
    -c $BUILD_CONFIGURATION \
    -o /app/publish \
    --no-restore \
    /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Tiku.Worker.dll"]
