Add Docker Compose file hosting integration#1277
Add Docker Compose file hosting integration#1277curiousvlxd wants to merge 1 commit intoCommunityToolkit:mainfrom
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1277Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1277" |
@dotnet-policy-service agree |
|
Hi @davidfowl, @danegsta, @isaacrlevin I wanted to share that I've implemented this feature based on the discussion here: microsoft/aspire#4375 and #1276 issue. The integration parses existing Docker Compose files and maps services to Aspire container resources with support for all compose format versions, ports, environment, volumes, depends_on, healthchecks, and includes a source generator. I completely agree with the direction discussed here that this belongs in the Community Toolkit. Would really appreciate any feedback. |
|
I dont think it does. I think it should be in the core potentially with first class support in dcp. |
@davidfowl Makes sense. My implementation parses yaml and explodes services into individual Aspire resources. Source generator on top works well too. Are you working on DCP-level integration already, or should I open a PR against |
|
Nobody is working on this it needs design, but it shoudn't go into the toolkit. |
@davidfowl should the Aspire team handle the design? I can take the implementation. |
|
Move this proposal to https://github.com/microsoft/aspire as a starting point, we can decide how it works there. |
Closes #1276
Overview
Adds a new hosting integration that imports existing Docker Compose files into the Aspire resource graph. Compose services become first-class Aspire resources with full support for
WaitFor, dependency management, health checks, and dashboard visibility.Features
builder.AddCompose(".infra/compose.yml")with string-based indexer accessCompose.*wrapper classes with IntelliSense properties per servicehealthcheckdefinitions mapped to AspireIHealthCheckwith interval/timeout supportservice_started,service_healthy,service_completed_successfullyUsage
Project structure
CommunityToolkit.Aspire.Hosting.Compose— runtime library (parsing, mapping, extension methods)CommunityToolkit.Aspire.Hosting.Compose.Generator— source generator (shipped as analyzer inside the NuGet package)PR Checklist
Other information
dotnet pack→ install via local feed →<ComposeReference>with source generator → build succeededinfra.Postgres) instead of string constantsComposeConstantscentralizes all compose spec keys to avoid hardcoded stringsPortMapper,EnvironmentMapper,VolumeMapper,CommandMapper,HealthcheckMapper,DependsOnMapper