[docs] Fix pnpm and Bun runtime support for PublishAsNpmScript#1020
Open
aspire-repo-bot[bot] wants to merge 1 commit into
Open
[docs] Fix pnpm and Bun runtime support for PublishAsNpmScript#1020aspire-repo-bot[bot] wants to merge 1 commit into
aspire-repo-bot[bot] wants to merge 1 commit into
Conversation
Documents microsoft/aspire#17178 which fixes the pnpm PublishAsNpmScript Docker runtime. The generated runtime Dockerfile now enables pnpm via Corepack before running the entrypoint, and Bun reuses the Bun build image for the runtime stage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
14 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the “Deploy JavaScript apps” documentation to explain how PublishAsNpmScript handles pnpm and Bun at container runtime, aligning guidance with the behavior introduced in microsoft/aspire#17178.
Changes:
- Added a new “pnpm and Bun with PublishAsNpmScript” subsection describing runtime-image behavior for pnpm (Corepack) and Bun (runtime image reuse).
- Added a C# AppHost example using
.WithPnpm().PublishAsNpmScript("start"). - Included an excerpt of the relevant generated Dockerfile lines for the pnpm case.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+497
to
+510
| ```csharp title="AppHost.cs — pnpm npm-script publish" | ||
| #pragma warning disable ASPIREJAVASCRIPT001 | ||
|
|
||
| var builder = DistributedApplication.CreateBuilder(args); | ||
| builder.AddDockerComposeEnvironment("compose"); | ||
|
|
||
| var frontend = builder | ||
| .AddJavaScriptApp("frontend", "../NodeFrontend") | ||
| .WithPnpm() | ||
| .PublishAsNpmScript("start") | ||
| .WithExternalHttpEndpoints(); | ||
|
|
||
| builder.Build().Run(); | ||
| ``` |
|
|
||
| `PublishAsNpmScript` works with pnpm and Bun in addition to npm and Yarn. The generated runtime Dockerfile stage is tailored to the package manager: | ||
|
|
||
| - **pnpm**: The runtime stage runs `corepack enable pnpm && pnpm --version` before the entrypoint, so pnpm is available when the start script executes. Without this step, the container fails at startup with exit code 127 because pnpm is not included in the base `node:alpine` image. |
3 tasks
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.
Documents changes from microsoft/aspire#17178 by
@davidfowl.Targeting
release/13.4based on the source PR milestone13.4.Why this PR is needed
PR microsoft/aspire#17178 fixed a bug where apps using
.WithPnpm().PublishAsNpmScript()would fail at container startup with exit code 127 becausepnpmwas not available in the finalnode:alpineruntime image. The fix enables pnpm via Corepack in the runtime stage, and Bun apps now reuse the Bun build image for the runtime stage.The existing
Deploy JavaScript appspage coversPublishAsNpmScriptbut did not document how pnpm or Bun are handled in the runtime image, leaving users without guidance on the correct pattern.What was changed
src/frontend/src/content/docs/deployment/javascript-apps.mdxto add a "pnpm and Bun with PublishAsNpmScript" subsection after the existing package-script server examples. The section:.WithPnpm().PublishAsNpmScript("start")corepack enable pnpm && pnpm --versionand theENTRYPOINT)Files modified
src/frontend/src/content/docs/deployment/javascript-apps.mdx(updated)