Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
GITHUB_TOKEN=${{ secrets.PAT_DISPATCH }}
Expand Down
22 changes: 16 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
# Build stage with multi-platform support
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG TARGETARCH
ARG BUILDPLATFORM
ARG GITHUB_TOKEN
ARG NUGET_SOURCE=github
WORKDIR /src
Expand All @@ -21,13 +23,21 @@ RUN if [ "${NUGET_SOURCE}" = "github" ]; then \
--store-password-in-clear-text; \
fi

# Restore dependencies (cached layer)
RUN dotnet restore "PayrollEngine.PayrollConsole.sln"
# Restore with architecture-specific runtime
RUN if [ "$TARGETARCH" = "arm64" ]; then \
dotnet restore "PayrollEngine.PayrollConsole.sln" --runtime linux-arm64; \
else \
dotnet restore "PayrollEngine.PayrollConsole.sln" --runtime linux-x64; \
fi

# Copy remaining source files and publish
# Copy remaining source files and publish with architecture-specific runtime
COPY . .
WORKDIR "/src/PayrollConsole"
RUN dotnet publish "PayrollEngine.PayrollConsole.csproj" -c Release -o /app/publish --no-restore
RUN if [ "$TARGETARCH" = "arm64" ]; then \
dotnet publish "PayrollEngine.PayrollConsole.csproj" -c Release -o /app/publish --runtime linux-arm64 --self-contained false; \
else \
dotnet publish "PayrollEngine.PayrollConsole.csproj" -c Release -o /app/publish --runtime linux-x64 --self-contained false; \
fi

# Runtime stage
FROM mcr.microsoft.com/dotnet/aspnet:10.0
Expand Down