Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated worker/Dockerfile for optimized Kubernetes deployment #387

Open
guycalledavinash opened this issue Mar 7, 2025 · 1 comment
Open

Comments

@guycalledavinash
Copy link

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.

@guycalledavinash
Copy link
Author

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"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant