Repository navigation
Description
Summary
The C# AppHost exposes WithContainerBuildOptions(o => o.TargetPlatform = ContainerTargetPlatform.LinuxArm64) (and the ContainerTargetPlatform enum) to control per-resource container build settings — most importantly the --platform flag for cross-compilation. These APIs are not exposed in the TypeScript AppHost bindings as of 13.4.
Verified with the Aspire CLI docs (13.4.0):
aspire docs api search "withContainerBuildOptions" --language typescript→ no results.aspire docs api search "containerTargetPlatform" --language typescript→ no results.aspire docs api search "targetPlatform" --language typescript→ no results (only unrelated MAUI types).- Both
WithContainerBuildOptionsandContainerTargetPlatformare returned under--language csharp. - The full
ContainerResourceTS member list (peraspire docs api get typescript/aspire.hosting/containerresource) contains:withBindMount,withBuildArg,withBuildSecret,withContainerCertificatePaths,withContainerName,withContainerNetworkAlias,withContainerRuntimeArgs,withDockerfile,withDockerfileBuilder,withDockerfileFactory,withEntrypoint,withImage,withImagePullPolicy,withImageRegistry,withImageSHA256,withImageTag,withLifetime,withVolume— nowithContainerBuildOptions. - The TS
withDockerfile(contextPath, dockerfilePath?, stage?)signature has noplatform/ build-options parameter either.
Repro / scenario
I have a TypeScript AppHost (apphost.mts) that builds container images via addContainer(...).withDockerfile(...) and publishes a Docker Compose deployment. The target host is a Raspberry Pi (linux/arm64) and the build host is linux/amd64, so I need to cross-compile.
In C# the casaloom AppHost does this cleanly with:
api.WithContainerBuildOptions(o => o.TargetPlatform = ContainerTargetPlatform.LinuxArm64);
web.WithContainerBuildOptions(o => o.TargetPlatform = ContainerTargetPlatform.LinuxArm64);
admin.WithContainerBuildOptions(o => o.TargetPlatform = ContainerTargetPlatform.LinuxArm64);In TS there is no equivalent. My current workaround is to set DOCKER_DEFAULT_PLATFORM=linux/arm64 globally when invoking aspire deploy, which buildx honors for every image in the build. That works for my single-target case but:
- It's all-or-nothing — can't have one resource build for amd64 and another for arm64 in the same publish.
- It's invisible in the AppHost, so devs reading the code don't see the platform decision.
- It doesn't compose well with mixed-architecture deployments (e.g. multi-arch manifests).
Ask
Port WithContainerBuildOptions and the ContainerTargetPlatform enum to the TypeScript AppHost API surface (Aspire.Hosting TS bindings, ContainerResource.withContainerBuildOptions(...)), with the same shape as the C# version. A minimal first cut would be just the targetPlatform setting; the full ContainerBuildOptionsCallbackContext surface can follow.
Suggested TS signature:
interface ContainerResource {
withContainerBuildOptions(
configure: (ctx: ContainerBuildOptionsCallbackContext) => void | Promise<void>
): ContainerResource;
}
enum ContainerTargetPlatform {
LinuxAmd64 = "linux/amd64",
LinuxArm64 = "linux/arm64",
LinuxArm = "linux/arm",
}Environment
- Aspire CLI / SDK: 13.4.0 (13.4.2 stable channel)
- AppHost language: TypeScript (
apphost.mts) - Publisher: Docker Compose (
addDockerComposeEnvironment)
Thanks!
Activity
joperezr commentedon Jun 5, 2026
🤖 Aspire triage pass — 2026-06-05 04:58 UTC
Area:
area-polyglotKind: feature-request
Repro: yes-minimal — see the
aspire docs api searchverifications and proposed TS signature in the issue body (no runtime crash; this is a missing API surface)Affected version(s): 13.4.0 / 13.4.2 (latest: 13.4.0). Not a regression — the TS bindings never exposed
WithContainerBuildOptions.Severity: S3 — workaround exists (
DOCKER_DEFAULT_PLATFORM=linux/arm64ataspire deploytime), but it's all-or-nothing and not visible in the AppHost.Urgency: ⚪ backlog — no milestone
Reason: feature-request for TS AppHost API parity with C#. S3, workaround exists, not a 13.4 regression — does not clear the 13.4.x servicing bar. Reasonable 13.5 candidate if the polyglot team wants to prioritize parity, but defaulting to backlog per the conservative bar.
Suggested owner(s): Sébastien Ros (@sebastienros) (score 50), backup David Pine (@IEvangelist) (score 19)
Evidence:
area-polyglot(last 90d): Expand TypeScript brownfield workspace validation #17510, Unify ATS withReference exports #15238area-polyglot(last 180d): Export TypeScript ATS metadata for documented AppHost APIs #17875, Aspire TS + Orleans - Argument of type 'OrleansService' is not assignable to parameter of type 'OrleansServiceClientHandle' #17666, Polyglot withHttpEndpointCallback / withEndpointCallback deadlocks when callback body performs nested RPC mutation #17391, Experimentally publish Aspire.Hosting.Integration.Analyzers for integration developers #17264,aspire updatefor TypeScript AppHost fails with "No code generator found for language: TypeScript" when CLI is older than target package version; leaves project in broken state #17077, Update API docs content for polyglot TypeScript support #17068, Add TypeScript parity for aspire.dev AppHost snippets #17047, Generate TypeScript API documentation from C# XML docs #17044, Clean up public docs for TypeScript AppHost GA #17043, Add TypeScript generated API compatibility validation #17041, Validate shipped CLI and bundle layout for TypeScript AppHosts #17040, Add stable TypeScript AppHost publish E2E coverage #17038, Expand TypeScript coverage for JavaScript hosting APIs #17037, Expand TypeScript brownfield and workspace validation #17036, Add end-to-end package-manager coverage for TypeScript AppHosts #17033, Add Node LTS CI matrix for TypeScript AppHosts #17030, TypeScript polyglot GA support policy #17029, EPIC: Make TypeScript polyglot AppHost support generally available #16961, TypeScript AppHost lacks a supportedupdateStatecallback surface (anytyping + noResourceCommandStateenum) #16771, TypeScript AppHost: exposeResourceCommandService.ExecuteCommandAsyncfor programmatic command execution #16770, TypeScript AppHost:UpdateCommandStateContextis missingResourceSnapshot(no health-gated commands) #16769, TypeScript AppHost missing high-level helpers like addViteApp / addNodeApp #16627, Improve TypeScript AppHost runtime error output #16522, Do not export C# init-only properties as ATS setters #16494, Typescript application host does not apply Aspire configuration provided via environment variables #16443 (heavy ownership of the TS AppHost bindings)area-polyglot(last 90d): Fix TypeScript AppHost deadlock for async callbacks #17508; multiple closed-completed (TypeScript AppHost: async configure callback deadlocks aspire start when stored inside lazy IOptions.Configure (RunAsync runs on NonConcurrentSynchronizationContext) #17487, Update API docs content for polyglot TypeScript support #17068, Clean up public docs for TypeScript AppHost GA #17043, Add TypeScript AppHost scaffold lint regression coverage #17035, Validate aspire doctor diagnostics for TypeScript AppHost package managers #17032, Document TypeScript AppHost package-manager support policy #17031, TypeScript AppHost projects pinned to 13.3.0 crash with TypeLoadException on 13.4 (binary-break from #16677) #16959, TypeScript AppHost code generation can fail with empty TypeLoadException when CLI and restored SDK DLL builds differ #16709)polyglot/ TS AppHost entry foundConfidence: high
Needs human?: no
Dry-run mode — no labels or milestone applied. Reply
/triage applyto promote, or edit and reapply.sebastienros commentedon Jun 17, 2026
This is now available in
main— the TypeScript AppHost bindings expose bothwithContainerBuildOptions(...)and theContainerTargetPlatformenum. The work landed after this issue was filed against 13.4.Introducing PR
[AspireExport(ExposeProperties = true)]toContainerBuildOptionsCallbackContext, exposingtargetPlatform(and therefore theContainerTargetPlatformenum) over ATS, and wired real usage into all four polyglot app hosts (Go/Java/Python/TypeScript).[AspireExport]to the asyncWithContainerBuildOptionsoverload, and [Automated] Update ATS API Surface Area #17977 regenerated the ATS coverage (Aspire.Hosting.ats.txt).TypeScript surface (generated)
This is per-resource (not all-or-nothing like
DOCKER_DEFAULT_PLATFORM) and visible in the AppHost, addressing the mixed-architecture concern raised here. The callback context also exposesservices,logger,executionContext(run vs. publish),destination,imageFormat,outputPath,localImageName, andlocalImageTag.Verification performed
Aspire.Hostingassembly — 99/99 passing (Aspire.Hosting.CodeGeneration.TypeScript.Tests), with snapshots coveringContainerResource.withContainerBuildOptions,ContainerTargetPlatform, andContainerBuildOptionsCallbackContext.targetPlatformget/set.apphost.mtsusing the exact cross-arch scenario above (addDockerfile(...).withContainerBuildOptions(ctx => ctx.targetPlatform.set(ContainerTargetPlatform.LinuxArm64))) against the real generated SDK —tscclean; a negative control with an invalid enum member is correctly rejected.tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.mts) already exercises this API, and it's covered by the Linux CLI end-to-end suite.Closing as completed. Please reopen if you hit a gap on a current
main/daily build.