Azure deploy provisions unhealthy Container App for build-only Vite resource consumed via PublishWithContainerFiles
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Summary
When a `AddViteApp` resource is consumed by a backend via `PublishWithContainerFiles` (Aspire Model 1: backend serves frontend), `aspire deploy` to Azure Container Apps still provisions a standalone `webfrontend` Container App. That app is not the production HTTP entrypoint (backend has external ingress and serves embedded static files), but it is deployed with `minReplicas: 1` and fails to start.
## Repro AppHost pattern
```csharp
var webfrontend = builder.AddViteApp("webfrontend", "../frontend")
.WithPort(5175);
if (!builder.ExecutionContext.IsRunMode)
{
webfrontend = webfrontend
.PublishAsDockerFile(context => context.WithDockerfile(repoRoot, "SevoHr/Dockerfile.frontend"))
.WithContainerFilesSource("/app/dist");
}
var server = builder.AddProject("server")
.WithExternalHttpEndpoints();
server.PublishWithContainerFiles(webfrontend, "wwwroot");
```
Frontend Dockerfile is build-stage only (no `CMD`/`ENTRYPOINT`) — output at `/app/dist` is copied into the server image.
## Deploy pipeline output
`validate-build-only-container-references` passes, yet deploy still runs:
- `build-webfrontend` / `push-webfrontend`
- `provision-webfrontend-containerapp` → "Successfully deployed webfrontend ... No public endpoints"
- `build-server` / `push-server` / `provision-server-containerapp` → public HTTPS URL (serves SPA correctly)
## Observed Azure state (ACA)
Container App `webfrontend` in resource group `rg-aspire-sevohrapphost`:
| Property | Value |
|----------|-------|
| Ingress | Internal only (`external: false`), target port 5175 |
| Scale | `minReplicas: 1`, `maxReplicas: 10` |
| Image | Build-stage frontend image (no runtime entrypoint) |
| `runningStatus` | Running (platform keeps trying) |
| Revision health | **Unhealthy** |
| Revision state | **ActivationFailed** |
Production users correctly use the `server` URL; the `webfrontend` ACA appears useless and wastes provisioning/retry overhead.
## Expected behavior
Per [Deploy JavaScript apps — build-only validation](https://aspire.dev/deployment/javascript-apps/#build-only-container-validation), a consumed build-only JS resource should not participate in deploy as a standalone compute resource. At minimum:
1. Do **not** provision an ACA for resources only consumed via `PublishWithContainerFiles`, **or**
2. If an ACA is required for image build/push, set `minReplicas: 0` and do not configure ingress/runtime for build-only artifacts.
## Environment
- Aspire AppHost SDK: 13.3.5
- `Aspire.Hosting.Azure.AppContainers`, `Aspire.Hosting.JavaScript`
- Target: Azure Container Apps (Consumption), Switzerland North
- Deploy tag: `aspire-deploy-20260531095433`
## Related docs
- https://aspire.dev/deployment/javascript-apps/ (Model 1: backend serves frontend)
- https://aspire.dev/app-host/container-files/ (`PublishWithContainerFiles`)
Contributor guide
Assessment
This issue has not been assessed yet.