diff --git a/Backend.Server/ProviderStartupExtensions.cs b/Backend.Server/ProviderStartupExtensions.cs index 9db005c..e6e8fa1 100644 --- a/Backend.Server/ProviderStartupExtensions.cs +++ b/Backend.Server/ProviderStartupExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using PayrollEngine.Api.Core; using PayrollEngine.Backend.Controller; +using PayrollEngine.Domain.Application; using PayrollEngine.Domain.Application.Service; using PayrollEngine.Domain.Model; @@ -221,6 +222,7 @@ public static IServiceCollection AddLocalApiServices(this IServiceCollection ser ctx.GetRequiredService())); // tenant controllers + services.AddTransient(); services.AddTransient(ctx => new TenantController( ctx.GetRequiredService(), ctx.GetRequiredService(), diff --git a/Directory.Build.props b/Directory.Build.props index 9dbd635..0a65c61 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,15 +4,16 @@ net9.0 0.9.0-beta.6 0.9.0 - - Jani Giannoudis - Software Consulting Giannoudis - 2025 Software Consulting Giannoudis - Payroll Engine Backend Server - https://payrollengine.org/ - https://github.com/Payroll-Engine/PayrollEngine.Backend.git - 1701;1702;8034;AD0001;RMG020;RMG012 - true + 0.9.0-beta.6 + Payroll Engine Backend + Payroll Engine GmbH + Payroll Engine + Copyright © 2024 + en + enable + + 1701;1702;8034;AD0001;RMG020;RMG012;CS8618 + false false diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ec1fd97 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +# Build stage with multi-platform support +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG TARGETARCH +ARG BUILDPLATFORM +WORKDIR /src + +# copy solution and project files +COPY ["PayrollEngine.Backend.sln", "./"] +COPY ["Api/Api.Controller/PayrollEngine.Api.Controller.csproj", "Api/Api.Controller/"] +COPY ["Api/Api.Core/PayrollEngine.Api.Core.csproj", "Api/Api.Core/"] +COPY ["Api/Api.Map/PayrollEngine.Api.Map.csproj", "Api/Api.Map/"] +COPY ["Api/Api.Model/PayrollEngine.Api.Model.csproj", "Api/Api.Model/"] +COPY ["Backend.Controller/PayrollEngine.Backend.Controller.csproj", "Backend.Controller/"] +COPY ["Backend.Server/PayrollEngine.Backend.Server.csproj", "Backend.Server/"] +COPY ["Domain/Domain.Application/PayrollEngine.Domain.Application.csproj", "Domain/Domain.Application/"] +COPY ["Domain/Domain.Model/PayrollEngine.Domain.Model.csproj", "Domain/Domain.Model/"] +COPY ["Domain/Domain.Model.Tests/PayrollEngine.Domain.Model.Tests.csproj", "Domain/Domain.Model.Tests/"] +COPY ["Domain/Domain.Scripting/PayrollEngine.Domain.Scripting.csproj", "Domain/Domain.Scripting/"] +COPY ["Persistence/Persistence/PayrollEngine.Persistence.csproj", "Persistence/Persistence/"] +COPY ["Persistence/Persistence.SqlServer/PayrollEngine.Persistence.SqlServer.csproj", "Persistence/Persistence.SqlServer/"] + +# copy Directory.Build.props files +COPY ["Directory.Build.props", "./"] + +# Restore with architecture-specific runtime +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + dotnet restore "PayrollEngine.Backend.sln" --runtime linux-arm64; \ + else \ + dotnet restore "PayrollEngine.Backend.sln" --runtime linux-x64; \ + fi + +# copy everything else +COPY . . +WORKDIR "/src/Backend.Server" + +# Publish with architecture-specific runtime and restore included +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + dotnet publish "PayrollEngine.Backend.Server.csproj" -c Release -o /app/publish --runtime linux-arm64 --self-contained false; \ + else \ + dotnet publish "PayrollEngine.Backend.Server.csproj" -c Release -o /app/publish --runtime linux-x64 --self-contained false; \ + fi + +# final stage +FROM mcr.microsoft.com/dotnet/aspnet:9.0 +WORKDIR /app +COPY --from=build /app/publish . +ENTRYPOINT ["dotnet", "PayrollEngine.Backend.Server.dll"] \ No newline at end of file