From 5aab7915941215840ad51c25c690526c534ca1d0 Mon Sep 17 00:00:00 2001 From: gsayer Date: Tue, 8 Jul 2025 20:57:09 +0200 Subject: [PATCH 1/3] feat(webapp): add Dockerfile for web application --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e4b4661 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# copy solution and project files +COPY ["PayrollEngine.WebApp.sln", "./"] +COPY ["Core/PayrollEngine.WebApp.Core.csproj", "Core/"] +COPY ["Presentation/PayrollEngine.WebApp.Presentation.csproj", "Presentation/"] +COPY ["Server/PayrollEngine.WebApp.Server.csproj", "Server/"] +COPY ["Shared/PayrollEngine.WebApp.Shared.csproj", "Shared/"] +COPY ["ViewModel/PayrollEngine.WebApp.ViewModel.csproj", "ViewModel/"] + +# copy Directory.Build.props +COPY ["Directory.Build.props", "./"] + +RUN dotnet restore "PayrollEngine.WebApp.sln" + +# copy everything else +COPY . . +WORKDIR "/src/Server" +RUN dotnet publish "PayrollEngine.WebApp.Server.csproj" -c Release -o /app/publish --no-restore + +# final stage +FROM mcr.microsoft.com/dotnet/aspnet:8.0 +WORKDIR /app +COPY --from=build /app/publish . +ENTRYPOINT ["dotnet", "PayrollEngine.WebApp.Server.dll"] \ No newline at end of file From c7aad14ada4e3c4ab3c5bc3e744a55c79eecd3d8 Mon Sep 17 00:00:00 2001 From: gsayer Date: Tue, 8 Jul 2025 21:38:20 +0200 Subject: [PATCH 2/3] feat: Dockerize application --- Directory.Build.props | 9 +++++++-- Dockerfile | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 94ef8b0..d85c6f2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,11 +4,16 @@ net9.0 0.9.0-beta.6 0.9.0 - + 0.9.0-beta.6 + Payroll Engine WebApp + Payroll Engine GmbH + Payroll Engine + Copyright © 2024 + en + enable Jani Giannoudis Software Consulting Giannoudis 2025 Software Consulting Giannoudis - Payroll Engine Web Application https://payrollengine.org/ https://github.com/Payroll-Engine/PayrollEngine.WebApp.git false diff --git a/Dockerfile b/Dockerfile index e4b4661..8f3a790 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src # copy solution and project files @@ -20,7 +20,7 @@ WORKDIR "/src/Server" RUN dotnet publish "PayrollEngine.WebApp.Server.csproj" -c Release -o /app/publish --no-restore # final stage -FROM mcr.microsoft.com/dotnet/aspnet:8.0 +FROM mcr.microsoft.com/dotnet/aspnet:9.0 WORKDIR /app COPY --from=build /app/publish . ENTRYPOINT ["dotnet", "PayrollEngine.WebApp.Server.dll"] \ No newline at end of file From 4f1dcb281998ab3c2ee761820e2ba27658a77628 Mon Sep 17 00:00:00 2001 From: gsayer Date: Sun, 13 Jul 2025 21:05:10 +0200 Subject: [PATCH 3/3] fix: resolve dotnet publish --no-restore issues with multi-architecture builds - Add BUILDPLATFORM and TARGETARCH support to Dockerfile - Use architecture-specific restore and publish commands - Remove problematic --no-restore flag to prevent NuGet resolution errors - Supports both ARM64 and x86_64 builds - Resolves build issues reported in PayrollEngine/PayrollEngine#2 --- Dockerfile | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f3a790..7b2a74a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +# 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 @@ -12,15 +15,26 @@ COPY ["ViewModel/PayrollEngine.WebApp.ViewModel.csproj", "ViewModel/"] # copy Directory.Build.props COPY ["Directory.Build.props", "./"] -RUN dotnet restore "PayrollEngine.WebApp.sln" +# Restore with architecture-specific runtime +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + dotnet restore "PayrollEngine.WebApp.sln" --runtime linux-arm64; \ + else \ + dotnet restore "PayrollEngine.WebApp.sln" --runtime linux-x64; \ + fi # copy everything else COPY . . WORKDIR "/src/Server" -RUN dotnet publish "PayrollEngine.WebApp.Server.csproj" -c Release -o /app/publish --no-restore + +# Publish with architecture-specific runtime and restore included +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + dotnet publish "PayrollEngine.WebApp.Server.csproj" -c Release -o /app/publish --runtime linux-arm64 --self-contained false; \ + else \ + dotnet publish "PayrollEngine.WebApp.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.WebApp.Server.dll"] \ No newline at end of file +ENTRYPOINT ["dotnet", "PayrollEngine.WebApp.Server.dll"] \ No newline at end of file