From e247fdfff318bdf2f402100fcab4ea64e2b63bf1 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 10 Nov 2025 14:45:22 -0800 Subject: [PATCH 1/6] Some tweaks for SDK publishing --- samples/dotnetapp/dotnetapp.csproj | 16 ++++-- samples/globalapp/Dockerfile.aot-sdk-publish | 12 ++++ samples/globalapp/globalapp.csproj | 58 +++++++++++++++++++- 3 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 samples/globalapp/Dockerfile.aot-sdk-publish diff --git a/samples/dotnetapp/dotnetapp.csproj b/samples/dotnetapp/dotnetapp.csproj index 83933833bb..0dd12331ef 100644 --- a/samples/dotnetapp/dotnetapp.csproj +++ b/samples/dotnetapp/dotnetapp.csproj @@ -5,12 +5,18 @@ net10.0 enable enable + linux-arm64;linux-x64 + linux-musl-arm64;linux-musl-x64 + + + 10.0.0-rc.2.25502.107 + mcr.microsoft.com/dotnet/runtime:10.0.0-rc.2 + mcr.microsoft.com/dotnet/runtime:10.0.0-rc.2-alpine3.22 - - - true + + + + diff --git a/samples/globalapp/Dockerfile.aot-sdk-publish b/samples/globalapp/Dockerfile.aot-sdk-publish new file mode 100644 index 0000000000..9c831900cd --- /dev/null +++ b/samples/globalapp/Dockerfile.aot-sdk-publish @@ -0,0 +1,12 @@ +# This image allows easily building and publishing AOT-compiled .NET applications +# To use: +# * mount the Docker socket: `-v /var/run/docker.sock:/var/run/docker.sock` +# * mount the source code directory: `-v /path/to/source:/source` +# * call `dotnet publish -t PublishContainer` with/on a project that +# has been configured for AOT compilation +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS builder +ARG TARGETARCH +RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh \ + && apt update \ + && apt install clang zlib1g-dev -y \ + && rm -rf /var/lib/apt/lists/* \ No newline at end of file diff --git a/samples/globalapp/globalapp.csproj b/samples/globalapp/globalapp.csproj index cf8ee5c65a..921ec7ec57 100644 --- a/samples/globalapp/globalapp.csproj +++ b/samples/globalapp/globalapp.csproj @@ -5,7 +5,63 @@ net10.0 enable enable - true + linux-arm64;linux-x64 + linux-musl-arm64;linux-musl-x64 + + + 10.0.0-rc.2.25502.107 + mcr.microsoft.com/dotnet/runtime:10.0.0-rc.2 + + + + noble-chiseled-extra + true + chiseled + + mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra + + + + alpine3.22-extra + true + alpine-chiseled + + mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-alpine3.22-extra + + + + true + false + sc + true + mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra + + + + false + true + true + trimmed + + mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra + + + + true + aot + + mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra + + + + true + aot-invariant + true + + mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled + + + From f18bbf339c807d0db7d774081d648dcde5ddedcf Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 11 Nov 2025 11:01:00 -0800 Subject: [PATCH 2/6] Clean up publishing variations --- samples/dotnetapp/dotnetapp.csproj | 6 --- .../Dockerfile.aot-sdk-publish.alpine | 11 ++++ samples/globalapp/globalapp.csproj | 53 ++++++++----------- 3 files changed, 33 insertions(+), 37 deletions(-) create mode 100644 samples/globalapp/Dockerfile.aot-sdk-publish.alpine diff --git a/samples/dotnetapp/dotnetapp.csproj b/samples/dotnetapp/dotnetapp.csproj index 0dd12331ef..b889b2c08b 100644 --- a/samples/dotnetapp/dotnetapp.csproj +++ b/samples/dotnetapp/dotnetapp.csproj @@ -7,12 +7,6 @@ enable linux-arm64;linux-x64 linux-musl-arm64;linux-musl-x64 - - - 10.0.0-rc.2.25502.107 - mcr.microsoft.com/dotnet/runtime:10.0.0-rc.2 - mcr.microsoft.com/dotnet/runtime:10.0.0-rc.2-alpine3.22 - diff --git a/samples/globalapp/Dockerfile.aot-sdk-publish.alpine b/samples/globalapp/Dockerfile.aot-sdk-publish.alpine new file mode 100644 index 0000000000..b40d87cb9f --- /dev/null +++ b/samples/globalapp/Dockerfile.aot-sdk-publish.alpine @@ -0,0 +1,11 @@ +# This image allows easily building and publishing AOT-compiled .NET applications +# To use: +# * mount the Docker socket: `-v /var/run/docker.sock:/var/run/docker.sock` +# * mount the source code directory: `-v /path/to/source:/source` +# * call `dotnet publish -t PublishContainer` with/on a project that +# has been configured for AOT compilation +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS builder +ARG TARGETARCH +RUN apk update \ + && apk upgrade \ + && apk add docker clang build-base zlib-dev \ No newline at end of file diff --git a/samples/globalapp/globalapp.csproj b/samples/globalapp/globalapp.csproj index 921ec7ec57..cdf81cd6f2 100644 --- a/samples/globalapp/globalapp.csproj +++ b/samples/globalapp/globalapp.csproj @@ -7,60 +7,51 @@ enable linux-arm64;linux-x64 linux-musl-arm64;linux-musl-x64 - - - 10.0.0-rc.2.25502.107 - mcr.microsoft.com/dotnet/runtime:10.0.0-rc.2 - - - noble-chiseled-extra - true + + + noble-chiseled chiseled - - mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra - - alpine3.22-extra - true - alpine-chiseled - - mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-alpine3.22-extra + + alpine + alpine + + + + noble + noble - true + true false - sc + $(ContainerImageTag)-sc true - mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra false true true - trimmed - - mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra + $(ContainerImageTag)-trimmed true - aot - - mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled-extra + $(ContainerImageTag)-aot - - true - aot-invariant - true - - mcr.microsoft.com/dotnet/runtime-deps:10.0.0-rc.2-noble-chiseled + + $(ContainerImageTag)-invariant + + $(ContainerImageTag)-variant + $(ContainerFamily)-extra + + From 024ee5dfb833a4dcbc6e3bfb08c9e72ed7eb3bcd Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 11 Nov 2025 13:26:32 -0600 Subject: [PATCH 3/6] Update samples/globalapp/Dockerfile.aot-sdk-publish.alpine Co-authored-by: Logan Bussell --- samples/globalapp/Dockerfile.aot-sdk-publish.alpine | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/samples/globalapp/Dockerfile.aot-sdk-publish.alpine b/samples/globalapp/Dockerfile.aot-sdk-publish.alpine index b40d87cb9f..8f2be5cd7e 100644 --- a/samples/globalapp/Dockerfile.aot-sdk-publish.alpine +++ b/samples/globalapp/Dockerfile.aot-sdk-publish.alpine @@ -4,8 +4,5 @@ # * mount the source code directory: `-v /path/to/source:/source` # * call `dotnet publish -t PublishContainer` with/on a project that # has been configured for AOT compilation -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS builder -ARG TARGETARCH -RUN apk update \ - && apk upgrade \ - && apk add docker clang build-base zlib-dev \ No newline at end of file +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine-aot AS builder +RUN apk add --no-cache docker \ No newline at end of file From 359038552d12350c980dfd914fabcd3c07a9b2ad Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 11 Nov 2025 11:38:51 -0800 Subject: [PATCH 4/6] use prebuilt AOT container for noble --- samples/globalapp/Dockerfile.aot-sdk-publish | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/samples/globalapp/Dockerfile.aot-sdk-publish b/samples/globalapp/Dockerfile.aot-sdk-publish index 9c831900cd..dcfd8614ba 100644 --- a/samples/globalapp/Dockerfile.aot-sdk-publish +++ b/samples/globalapp/Dockerfile.aot-sdk-publish @@ -4,9 +4,6 @@ # * mount the source code directory: `-v /path/to/source:/source` # * call `dotnet publish -t PublishContainer` with/on a project that # has been configured for AOT compilation -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS builder +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-noble-aot AS builder ARG TARGETARCH -RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh \ - && apt update \ - && apt install clang zlib1g-dev -y \ - && rm -rf /var/lib/apt/lists/* \ No newline at end of file +RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh \ No newline at end of file From da0011bc9dfb2f17ca589c8dde9c423b2aa29fe2 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Wed, 12 Nov 2025 11:30:48 -0800 Subject: [PATCH 5/6] add dockerignore to prevent huge docker builds --- samples/globalapp/.dockerignore | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 samples/globalapp/.dockerignore diff --git a/samples/globalapp/.dockerignore b/samples/globalapp/.dockerignore new file mode 100644 index 0000000000..aa573f5522 --- /dev/null +++ b/samples/globalapp/.dockerignore @@ -0,0 +1,55 @@ +# .NET build artifacts +bin/ +obj/ +out/ + +# Visual Studio / VS Code +.vs/ +.vscode/ +*.suo +*.user +*.userosscache +*.sln.docstates +*.swp +*.*~ +project.lock.json + +# NuGet +*.nupkg +*.snupkg +packages/ +.nuget/ + +# Test results +TestResults/ +[Tt]est[Rr]esult*/ +*.trx +*.coverage +*.coveragexml + +# Build logs +*.binlog +*.log + +# OS files +.DS_Store +Thumbs.db + +# Git +.git/ +.gitignore +.gitattributes + +# Docker +.dockerignore +Dockerfile* +docker-compose* + +# CI/CD +.github/ +.gitlab-ci.yml +azure-pipelines.yml + +# Documentation +*.md +LICENSE From 7f655ecbafec5a72bf3f2a2a1217b0f113187788 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Thu, 11 Dec 2025 12:35:52 -0600 Subject: [PATCH 6/6] Update samples/globalapp/Dockerfile.aot-sdk-publish.alpine Co-authored-by: Logan Bussell --- samples/globalapp/Dockerfile.aot-sdk-publish.alpine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/globalapp/Dockerfile.aot-sdk-publish.alpine b/samples/globalapp/Dockerfile.aot-sdk-publish.alpine index 8f2be5cd7e..a74c994f8a 100644 --- a/samples/globalapp/Dockerfile.aot-sdk-publish.alpine +++ b/samples/globalapp/Dockerfile.aot-sdk-publish.alpine @@ -5,4 +5,4 @@ # * call `dotnet publish -t PublishContainer` with/on a project that # has been configured for AOT compilation FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0-alpine-aot AS builder -RUN apk add --no-cache docker \ No newline at end of file +RUN apk add --no-cache docker-cli \ No newline at end of file