Expose Dockerfile builder APIs to polyglot apphosts#15867
Merged
sebastienros merged 7 commits intomainfrom Apr 14, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes the programmatic Dockerfile builder flow to polyglot AppHosts (TypeScript/Python/Java) by exporting the needed ATS callback context and adding curated Dockerfile DSL wrapper exports, then updates polyglot validation fixtures and regenerates language snapshots to cover the new surface.
Changes:
- Export
AddDockerfileBuilder/WithDockerfileBuilder(async callback overloads) to ATS and exportDockerfileBuilderCallbackContext+ Dockerfile DSL handles. - Add curated ATS exports for the Dockerfile DSL (builder/stage statements + container-files helpers) while keeping internal helper extensions hidden from polyglot.
- Fix codegen edge cases around duplicate type IDs / capability collisions and refresh TS/Python/Java generated snapshots + validation AppHosts.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.ts | Exercises the new Dockerfile builder callback surface in the TypeScript polyglot validation AppHost. |
| tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py | Exercises the new Dockerfile builder callback surface in the Python polyglot validation AppHost. |
| tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java | Exercises the new Dockerfile builder callback surface in the Java polyglot validation AppHost. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts | Updates the TypeScript generated SDK snapshot to include Dockerfile builder/stage/context APIs and capabilities. |
| tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt | Updates the TS capability snapshot to include withDockerfileBuilder. |
| tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py | Updates the Python generated SDK snapshot to include Dockerfile builder/stage/context APIs and capabilities. |
| tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java | Updates the Java generated SDK snapshot to include Dockerfile builder/stage/context APIs and capabilities. |
| src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs | Re-enables ATS export for async Dockerfile builder APIs and adjusts polyglot availability remarks. |
| src/Aspire.Hosting/Ats/DockerfileBuilderExports.cs | Adds curated ATS exports for Dockerfile DSL statements and container-files helpers. |
| src/Aspire.Hosting/ApplicationModel/DockerfileBuilderCallbackContext.cs | Marks the callback context as ATS-exported (property exposure enabled) for polyglot callbacks. |
| src/Aspire.Hosting/ApplicationModel/Docker/DockerfileStage.cs | Marks Dockerfile stage type as ATS-exported so it can flow through polyglot handles. |
| src/Aspire.Hosting/ApplicationModel/Docker/DockerfileBuilder.cs | Marks Dockerfile builder type as ATS-exported so it can flow through polyglot handles. |
| src/Aspire.Hosting/ApplicationModel/Docker/ContainerFilesExtensions.cs | Hides raw container-files extension exports in favor of curated ATS wrappers. |
| src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs | Deduplicates builder models by TypeId to prevent duplicate type/capability issues in Python generation. |
| src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs | Resolves duplicate handle types by AtsTypeId, preferring resource-builder variants when present. |
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15867Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15867" |
JamesNK
reviewed
Apr 5, 2026
7d032ff to
85b124c
Compare
Re-enable the Dockerfile builder callback surface for TypeScript, Python, and Java apphosts through ATS-safe wrapper exports. Also add curated container-files wrapper exports, fix generator handling for duplicate handle/builder type IDs and run-capability naming, update the real polyglot validation apphosts, and refresh the affected codegen snapshots. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the Go and Rust two-pass generated Aspire snapshots after the Dockerfile builder polyglot export changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the AspireExportIgnore reasons on the synchronous Dockerfile builder overloads to reflect that only the async callback overload is exported to polyglot apphosts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collapse duplicate ATS handle types by type ID while preserving resource-builder classification in the Java, Go, and Rust generators. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
37820c5 to
fa20787
Compare
Contributor
|
🎬 CLI E2E Test Recordings — 69 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #24356447632 |
davidfowl
approved these changes
Apr 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Expose the programmatic Dockerfile builder flow to polyglot AppHosts.
AddDockerfileBuilderandWithDockerfileBuilderfor ATS/code generation and export the Dockerfile builder callback surface needed by TypeScript, Python, and Java.Fixes #15858
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: