Skip to content

captainsafia/aspire-docker-compose-deploy

Repository files navigation

Docker Compose Deploy with Aspire

This repository demonstrates how to build, publish, and deploy a Aspire application to Docker Compose using the Aspire CLI. It includes both a C# minimal API and a Python FastAPI service.

Demo

🚀 Quick Start

Prerequisites

Running Locally with Aspire

  1. Clone the repository
git clone <repository-url>
cd <directory-name>
  1. Run with Aspire
aspire run

This will start the Aspire dashboard and launch all services locally.

📦 Deployment Workflow

This repository showcases the complete Aspire deployment pipeline from development to production using Docker Compose. This process can be done in 3 progressive stages that generate more complete assets and deployment assets.

Step 1: Publish the Application

aspire publish --output-path publish-output

This command:

  • Generate a docker-compose.yaml from the app host
  • Generate a .env file with expected parameters, unfilled
  • Outputs everything to the aspire-output directory

Step 2: Prepare Environment Configurations

Staging Environment

aspire do prepare-env --environment staging

Production Environment

aspire do prepare-env --environment production

These commands:

  • Generate a docker-compose.yaml from the app host
  • Generate environment-specific .env files with filed in values
  • Generates container images
  • Outputs everything to the aspire-output directory

Step 3: Deploy to Docker Compose

aspire deploy

This final step:

  • Generate a docker-compose.yaml from the app host
  • Generate environment-specific .env files with filed in values
  • Generates container images
  • Outputs everything to the prepare-env-{environment} directory
  • Runs docker compose up against the generated files

(Optional) Step 4: Clean Up Deployment

The docker-compose-down-{env} step can be invoked to clean up the running Docker Compose instance.

aspire do docker-compose-down-env

About

Demo of generating assets for Docker Compose from Aspire apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published