docker-dotnet/dockerfiles/sdk.Dockerfile
Mathias Beaulieu-Duncan bb3f52b265
Some checks failed
Build and Push .NET Images / discover (release) Successful in 1s
Build and Push .NET Images / build (release) Failing after 9m35s
Strip unused SDK components to reduce image size
Remove templates, TestHostNetFramework, and DotnetTools from SDK image.
These are not needed for dotnet restore/build/publish and save ~124 MB.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:17:44 -05:00

17 lines
548 B
Docker

FROM scratch
ARG TARGETARCH
ADD build-${TARGETARCH}/sdk/rootfs.tar.gz /
COPY dotnet-${TARGETARCH}/sdk/ /usr/share/dotnet/
# Strip components not needed for building
RUN rm -rf /usr/share/dotnet/templates \
/usr/share/dotnet/sdk/*/TestHostNetFramework \
/usr/share/dotnet/sdk/*/DotnetTools
ENV DOTNET_ROOT=/usr/share/dotnet
ENV PATH="/usr/share/dotnet:${PATH}"
ENV DOTNET_RUNNING_IN_CONTAINER=true
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
ENV HOME=/home/nonroot
ENV DOTNET_CLI_HOME=/home/nonroot
WORKDIR /app
USER 65532