Updated worker/Dockerfile for optimized Kubernetes deployment
Opened this issue · 1 comments
Changes:
Added platform-specific build arguments to ensure cross-platform compatibility.
Optimized dotnet restore and dotnet publish steps for better caching and faster builds.
Removed unnecessary dependencies and improved layering to reduce image size.
Ensured compatibility with Kubernetes deployments by maintaining a minimal runtime image.
Updated Dockerfile to optimize for Kubernetes deployment
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG TARGETPLATFORM
ARG TARGETARCH
ARG BUILDPLATFORM
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
WORKDIR /source
COPY *.csproj .
RUN dotnet restore -a $TARGETARCH
COPY . .
RUN dotnet publish -c release -o /app -a $TARGETARCH --self-contained false --no-restore
App image with minimal runtime
FROM mcr.microsoft.com/dotnet/runtime:7.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Worker.dll"]