Skip to content

Commit 8a36d74

Browse files
authored
Merge pull request #1 from gsayer/feature/docker-stack
Add Docker support for web application
2 parents 470213a + 4f1dcb2 commit 8a36d74

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

Directory.Build.props

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@
44
<TargetFramework>net9.0</TargetFramework>
55
<Version>0.9.0-beta.6</Version>
66
<FileVersion>0.9.0</FileVersion>
7-
<InformationalVersion></InformationalVersion>
7+
<InformationalVersion>0.9.0-beta.6</InformationalVersion>
8+
<Description>Payroll Engine WebApp</Description>
9+
<Company>Payroll Engine GmbH</Company>
10+
<Product>Payroll Engine</Product>
11+
<Copyright>Copyright © 2024</Copyright>
12+
<NeutralLanguage>en</NeutralLanguage>
13+
<Nullable>enable</Nullable>
814
<Authors>Jani Giannoudis</Authors>
915
<Company>Software Consulting Giannoudis</Company>
1016
<Copyright>2025 Software Consulting Giannoudis</Copyright>
11-
<Product>Payroll Engine Web Application</Product>
1217
<PackageProjectUrl>https://payrollengine.org/</PackageProjectUrl>
1318
<RepositoryUrl>https://github.com/Payroll-Engine/PayrollEngine.WebApp.git</RepositoryUrl>
1419
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Build stage with multi-platform support
2+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS build
3+
ARG TARGETARCH
4+
ARG BUILDPLATFORM
5+
WORKDIR /src
6+
7+
# copy solution and project files
8+
COPY ["PayrollEngine.WebApp.sln", "./"]
9+
COPY ["Core/PayrollEngine.WebApp.Core.csproj", "Core/"]
10+
COPY ["Presentation/PayrollEngine.WebApp.Presentation.csproj", "Presentation/"]
11+
COPY ["Server/PayrollEngine.WebApp.Server.csproj", "Server/"]
12+
COPY ["Shared/PayrollEngine.WebApp.Shared.csproj", "Shared/"]
13+
COPY ["ViewModel/PayrollEngine.WebApp.ViewModel.csproj", "ViewModel/"]
14+
15+
# copy Directory.Build.props
16+
COPY ["Directory.Build.props", "./"]
17+
18+
# Restore with architecture-specific runtime
19+
RUN if [ "$TARGETARCH" = "arm64" ]; then \
20+
dotnet restore "PayrollEngine.WebApp.sln" --runtime linux-arm64; \
21+
else \
22+
dotnet restore "PayrollEngine.WebApp.sln" --runtime linux-x64; \
23+
fi
24+
25+
# copy everything else
26+
COPY . .
27+
WORKDIR "/src/Server"
28+
29+
# Publish with architecture-specific runtime and restore included
30+
RUN if [ "$TARGETARCH" = "arm64" ]; then \
31+
dotnet publish "PayrollEngine.WebApp.Server.csproj" -c Release -o /app/publish --runtime linux-arm64 --self-contained false; \
32+
else \
33+
dotnet publish "PayrollEngine.WebApp.Server.csproj" -c Release -o /app/publish --runtime linux-x64 --self-contained false; \
34+
fi
35+
36+
# final stage
37+
FROM mcr.microsoft.com/dotnet/aspnet:9.0
38+
WORKDIR /app
39+
COPY --from=build /app/publish .
40+
ENTRYPOINT ["dotnet", "PayrollEngine.WebApp.Server.dll"]

0 commit comments

Comments
 (0)