A step-by-step guide to building a Docker image for a .NET application using Marten as an event store. The key challenge is handling Marten's code generation, which must run before the build step when using static type loading in production. The guide covers a multistage Dockerfile with configurable build arguments for .NET version, project name, and whether to run code generation, plus the required Marten.CommandLine NuGet package setup and OptimizeArtifactWorkflow configuration.