Skip to content

.NET Aspire ‐ deployment

Thang Chung edited this page Nov 20, 2024 · 1 revision

Prerequisites

If you run on Windows 11:

> cargo install just
# https://cheatography.com/linux-china/cheat-sheets/justfile/

Generate manifest file (powershell)

dotnet run --project app-host\CoffeeShop.AppHost.csproj `
    --publisher manifest `
    --output-path ../aspire-manifest.json

Deploy to Kubernetes

dotnet tool install -g aspirate --prerelease

Run with Justfile (cross-platform)

> just run

On Windows 11 - WSL2 Ubuntu 22 integrated, we can use Podman Desktop to replace Docker for Desktop, and run .NET Aspire normally. Check this blog post -> https://dev.to/thangchung/net-8-integration-tests-on-podman-desktop-windows-11-wsl2-ubuntu-23-4hpo

Run with Makefile (Ubuntu)

> touch .env
> make run
# http://localhost:5019
dotnet publish "/workspaces/coffeeshop-aspire/app-host/../product-api/CoffeeShop.ProductApi.csproj" -p:PublishProfile="DefaultContainer" -p:PublishSingleFile="true" 
-p:PublishTrimmed="false" --self-contained "true" --verbosity "quiet" --nologo -r "linux-x64" -p:ContainerRegistry="k3d-myregistry.localhost:12345" -p:ContainerRepository="product-api" -p:ContainerImageTag="latest"

References