Skip to content

docs(codegen): recover Marten DevOps Dockerfile + 'codegen write' guidance (#2846)#2847

Merged
jeremydmiller merged 1 commit into
mainfrom
docs-2846-dockerfile-codegen-write
May 19, 2026
Merged

docs(codegen): recover Marten DevOps Dockerfile + 'codegen write' guidance (#2846)#2847
jeremydmiller merged 1 commit into
mainfrom
docs-2846-dockerfile-codegen-write

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Summary

Closes #2846.

Marten 9.0 removed its runtime code-generation pipeline entirely, and the Marten 9.0 docs cleanup (marten#4498) followed up by stripping the dotnet run -- codegen write Dockerfile section from Marten's DevOps page. That guidance no longer applies to Marten, but Wolverine still ships its own runtime codegen, so the multi-stage build pattern (pre-generate handler/endpoint adapters into Internal/Generated/, ship static C# in the production image) is directly applicable to Wolverine apps.

Replaces the placeholder "Embedding Codegen in Docker" section in docs/guide/codegen.md (which previously pointed at the now-removed Marten page) with the recovered guidance adapted for Wolverine.

What the new section covers

  • Wire up the CLI command — note that return await app.RunJasperFxCommands(args); is the last-line requirement to make dotnet run -- codegen write reachable.
  • Multi-stage Dockerfile — full SDK → publish → runtime layout, base images bumped to mcr.microsoft.com/dotnet/sdk:9.0-alpine / aspnet:9.0-alpine to match Wolverine 6.0's minimum TFM. Includes the non-root user + EXPOSE 5000 hygiene the Marten original had.
  • Caveat the issue called out — "The codegen write step has no runtime resources." Explains why eager DB/broker connections in Program.cs break the build-stage step, with two mitigations: defer to hosted services / DI factories, or use the CodeGeneration.IsRunningGeneration() short-circuit pattern that already lives further down the same page (cross-linked).
  • Cross-link to AOT — points at docs/guide/aot.md for the trim/AOT follow-on once a Static-mode image is in place.

Doc home

Picked option #2 from the issue ("new section inside existing docs/guide/codegen.md") because:

  1. The existing ## Embedding Codegen in Docker H2 anchor was already cross-referenced from the WolverineFx.RuntimeCompilation section earlier in the page (see [Embedding Codegen in Docker](#embedding-codegen-in-docker) below). Replacing the section in place keeps that link working.
  2. No new file means no Vitepress sidebar/nav change.
  3. The topic is squarely a codegen-deployment concern, as the issue notes.

Test plan

  • git diff clean — pure content swap inside the existing ## Embedding Codegen in Docker section.
  • Existing cross-reference from line 182 still resolves to the same anchor (#embedding-codegen-in-docker).
  • CI / docs preview

🤖 Generated with Claude Code

Marten 9.0 removed its runtime codegen pipeline entirely (marten#4461) and
the Marten 9.0 docs cleanup (marten#4498) stripped the
`dotnet run -- codegen write` Dockerfile section from Marten's DevOps page.
That guidance no longer applies to Marten but is squarely applicable to
Wolverine — Wolverine still ships runtime codegen and the same multi-stage
build pattern (pre-generate adapters into `Internal/Generated/`, ship static
C# in the production image) gives Wolverine apps a Roslyn-free cold start.

Replaces the placeholder section in docs/guide/codegen.md (which previously
linked to the now-removed Marten page) with:

* CLI wire-up note (`return await app.RunJasperFxCommands(args);`)
* Full multi-stage Dockerfile, base images bumped to `9.0-alpine` to match
  Wolverine 6.0's minimum TFM
* `codegen write` constraint paragraph — the build-stage run can't reach
  external resources, with two mitigation patterns
* Cross-link to the AOT publishing guide for the trim/AOT follow-on

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeremydmiller jeremydmiller merged commit 82cd483 into main May 19, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: add Dockerfile / 'codegen write' guidance recovered from Marten DevOps page

1 participant