Minimal API Workshop
Module 5

Aspire, Containers & Shipping

AppHost · dashboard · containers · versioning

3:45 – 4:40 PM

By the end you can

What Aspire is — and is not

The AppHost

var builder = DistributedApplication.CreateBuilder(args);

var payments = builder.AddProject<Projects.Roastery_Payments>("payments");

builder.AddProject<Projects.Roastery_Api>("api")
       .WithReference(payments)
       .WithExternalHttpEndpoints();

builder.Build().Run();

WithReference injects the payment address; service discovery resolves https://payments.

ServiceDefaults

builder.AddServiceDefaults();   // OTel, health, discovery, resilience
// ...
app.MapDefaultEndpoints();      // /health and /alive

One extension every service calls. The OTel + health code from Lab 4 moves here.

The dashboard payoff

A container image — no Dockerfile

dotnet publish src/Roastery.Api -c Release \
    --os linux --arch x64 /t:PublishContainer

# base image, non-root user, port 8080 — all chosen for you
docker run -p 8080:8080 -e Jwt__SigningKey=$KEY roastery-api

Double-underscore env vars map to config sections. Same code, laptop → container → cloud.

Version before the first client

builder.Services.AddApiVersioning(o =>
{
    o.DefaultApiVersion = new ApiVersion(1);
    o.ReportApiVersions = true;
});

var v1 = app.MapGroup("/api/v{version:apiVersion}")
            .WithApiVersionSet(versions).MapToApiVersion(1);
v1.MapProductEndpoints();

URLs become /api/v1/…; a v2 endpoint lives beside v1 with no change to v1's code.

The deployment landscape

TargetHow
Azure Container Appsazd up from the Aspire manifest
KubernetesAspire manifest → manifests / Helm
Any container hostThe image + environment variables

The instructor plays a recorded azd up — conference Wi-Fi has ended more demos than bad code.

Lab

Lab 5 · Run It Like Production

Ends at checkpoint-5

Minimal API Workshop
Wrap-up

You built Roastery.

Architecture review · retrospective · where to go next

4:40 – 5:00 PM

Module 5 — Shipping
1 / 1
Speaker notes

Keyboard

SpaceNext (reveals bullets, then advances)
Back
Home / EndFirst / last
gOverview grid
sSpeaker notes
tLight / dark
fFullscreen
pPrint / save PDF
?This help
EscClose help/overview, or exit to the site

Swipe left/right on touch screens.