In this tutorial, you take the app you created in the Build your first Aspire app — C# AppHost quickstart and deploy it. This can be broken down into several key steps:
Clean up resources - Remove any deployed resources to avoid incurring costs.
The following diagram shows the architecture of the sample app you’re deploying:
NodeJS and static site server containerAPI servicehttpsReact frontend
The React (Vite) and Express starter template consists of two resources that are deployed as a single container. The Express server hosts both the API and the static frontend files generated by React.
In this tutorial, you take the app you created in the Build your first Aspire app — Go AppHost quickstart and deploy it. This can be broken down into several key steps:
Clean up resources - Remove any deployed resources to avoid incurring costs.
The following diagram shows the architecture of the sample app you’re deploying:
Go API and static site containerAPI servicehttpsReact frontend
The Go and React (Vite) starter template consists of two resources that are deployed as a single container image. The app resource is the Go API, and PublishWithContainerFiles copies the built React frontend into that image under ./static. At run time, the Go server serves both the /api/weatherforecast API and the static frontend files, so there’s one container to deploy and one URL to open.
In the root directory of your Aspire solution that you created in the previous quickstart, add the appropriate hosting deployment package by running the following command in your terminal:
Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to use a YAML file to configure your application’s services, networks, and volumes, making it easier to manage and deploy complex applications locally or in various environments.
Aspire CLI — Add Docker Compose
aspireadddocker
The Aspire CLI is interactive, be sure to select the appropriate search result for the 📦 Aspire.Hosting.Docker version you want to add.
Aspire CLI — Add Azure App Containers
aspireaddazure-appcontainers
The Aspire CLI is interactive, be sure to select the appropriate search result for the 📦 Aspire.Hosting.Azure.AppContainers version you want to add.
If prompted for additional selections, use the Up Arrow↑Up Arrow↑Up Arrow↑ and Down Arrow↓Down Arrow↓Down Arrow↓ keys to navigate the options. Press ReturnReturnEnterEnterEnterEnter to confirm your selection.
Learn more about the aspire add command in the reference docs.
In the root directory of your Aspire app that you created in the previous quickstart, add the appropriate hosting deployment package by running the following command in your terminal:
Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to use a YAML file to configure your application’s services, networks, and volumes, making it easier to manage and deploy complex applications locally or in various environments.
Aspire CLI — Add Docker Compose
aspireadddocker
The Aspire CLI is interactive, be sure to select the appropriate search result for the 📦 Aspire.Hosting.Docker version you want to add.
Aspire CLI — Add Azure App Containers
aspireaddazure-appcontainers
The Aspire CLI is interactive, be sure to select the appropriate search result for the 📦 Aspire.Hosting.Azure.AppContainers version you want to add.
If prompted for additional selections, use the Up Arrow↑Up Arrow↑Up Arrow↑ and Down Arrow↓Down Arrow↓Down Arrow↓ keys to navigate the options. Press ReturnReturnEnterEnterEnterEnter to confirm your selection.
Learn more about the aspire add command in the reference docs.
In the root directory of your Aspire app that you created in the previous quickstart, add the appropriate hosting deployment package by running the following command in your terminal. The Aspire CLI adds the package to aspire.config.json and regenerates the Go SDK in .aspire/modules.
Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to use a YAML file to configure your application’s services, networks, and volumes, making it easier to manage and deploy complex applications locally or in various environments.
Aspire CLI — Add Docker Compose
aspireadddocker
The Aspire CLI is interactive, be sure to select the appropriate search result for the 📦 Aspire.Hosting.Docker version you want to add.
Aspire CLI — Add Azure App Containers
aspireaddazure-appcontainers
The Aspire CLI is interactive, be sure to select the appropriate search result for the 📦 Aspire.Hosting.Azure.AppContainers version you want to add.
If prompted for additional selections, use the Up Arrow↑Up Arrow↑Up Arrow↑ and Down Arrow↓Down Arrow↓Down Arrow↓ keys to navigate the options. Press ReturnReturnEnterEnterEnterEnter to confirm your selection.
Learn more about the aspire add command in the reference docs.
When deploying to Azure, the aspire deploy command is interactive. To avoid prompts (for example, when running in CI/CD), set the following environment variables:
09:21:49 (print-apiservice-summary) i [INF] Successfully deployed apiservice to Azure Container Apps environment env. No public endpoints were configured.
When you call aspire deploy, the Aspire CLI builds the container images for your resources, pushes them to the target environment (if applicable), and deploys the resources according to the configuration in your AppHost.
Additional information about this command can be found in the aspire deploy reference docs.
Now that you’ve added the deployment package and updated your AppHost, you can deploy your Aspire app.
When deploying to Azure, the aspire deploy command is interactive. To avoid prompts (for example, when running in CI/CD), set the following environment variables:
When you call aspire deploy, the Aspire CLI builds the container images for your resources, pushes them to the target environment (if applicable), and deploys the resources according to the configuration in your AppHost.
Additional information about this command can be found in the aspire deploy reference docs.
Now that you’ve added the deployment package and updated your AppHost, you can deploy your Aspire app.
Deploying to Docker Compose builds the container images and starts the services locally using Docker Compose.
Aspire CLI — Deploy your app
aspiredeploy
The deploy builds one image for the app resource. For a Go app, Aspire generates a multi-stage Dockerfile that builds the Go binary, then copies in the React build output from the frontend resource at ./static. When the deployment finishes, the output includes a print-app-summary step with the local URL for the app.
Consider the following example output:
Example output for deploying Go/React app to Docker Compose
Aspire CLI - Deploy Go/React app with Docker Compose
Deploying to Azure App Containers provisions the Azure resources, builds and pushes the container image, and deploys the app.
Aspire CLI — Deploy your app
aspiredeploy
The Aspire CLI prompts for the Azure subscription, location, and resource group if they aren’t already configured. To avoid prompts (for example, in CI/CD), set the Azure__SubscriptionId, Azure__Location, and Azure__ResourceGroup environment variables. The deploy builds one image for the app resource (the Go API with the bundled React frontend), pushes it to an Azure Container Registry, and deploys it to an Azure Container Apps environment.
Consider the following example output:
Example output for deploying Go/React app to Azure App Containers
Aspire CLI - Deploy Go/React app to Azure App Containers
🛠️Executingstepdeploy
07:10:15 (prepare-azure-container-apps-env) i [INF] HTTP endpoints will use HTTPS (port443) in Azure Container Apps: app:http. To opt out, use .WithHttpsUpgrade(false) on the container app environment.
After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target. This may include files such as Docker Compose files, Kubernetes manifests, or cloud provider-specific configuration files.
The aspire-output directory contains the generated environment variables and the Docker Compose configuration. The best part is, these files are opaque to you as a developer. You don’t need to write them yourself.
The .env.Production file contains the name of the app image:
./aspire-output/.env.Production
# Container image name for apiservice
APISERVICE_IMAGE=apiservice:latest
# Default container port for apiservice
APISERVICE_PORT=8080
# Container image name for webfrontend
WEBFRONTEND_IMAGE=webfrontend:latest
# Default container port for webfrontend
WEBFRONTEND_PORT=8080
Finally, the docker-compose.yaml file defines the services for both the API and frontend:
After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target. This may include files such as Docker Compose files, Kubernetes manifests, or cloud provider-specific configuration files.
The aspire-output directory contains the generated environment variables, an app.Dockerfile, and the Docker Compose configuration. The best part is, these files are opaque to you as a developer. You don’t need to write them yourself.
The app.Dockerfile is generated as a multi-stage Dockerfile to build the Express API and also serve the React frontend:
After a deployment, the Aspire CLI writes to the provided output path (or the default output path if none is provided) a set of files based on your deployment target.
The aspire-output directory contains the generated environment variables, an app.Dockerfile, and the Docker Compose configuration. These files are generated for you, so you don’t need to write them yourself.
The app.Dockerfile is a multi-stage Dockerfile that builds the Go API and includes the React frontend under ./static:
./aspire-output/app.Dockerfile
ARG FRONTEND_IMAGENAME=frontend:latest
FROM golang:1.26-alpine AS build
WORKDIR /app
ENV CGO_ENABLED=0
ENV GOOS=linux
COPY go.mod ./
COPY go.sum ./
RUN --mount=type=cache,target=/root/go/pkg/mod \
go mod download
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg/mod \
When deploying to Docker Compose, the aspire deploy command displays the URLs where your services are running. Look for the print-*-summary steps in the deployment output, which show the localhost URLs for each service that has been configured with WithExternalHttpEndpoints.
In the deployment output, you’ll see lines similar to the following:
Aspire CLI - Deployment summary
14:28:35 (print-env-dashboard-summary) i [INF] Successfully deployed env-dashboard to http://localhost:54633.
14:28:35 (print-webfrontend-summary) i [INF] Successfully deployed webfrontend to http://localhost:54463.
Open your web browser and navigate to the URL shown for your web frontend (for example, http://localhost:54463) to see your deployed application.
The frontend displays the weather forecast data in the ASP.NET Core Blazor application.
When deploying to Azure App Containers, you can verify that your ASP.NET Core/Blazor application is running by navigating to the URL provided in the deployment output. Look for a line similar to the following in the output:
Aspire CLI - Deployment summary
09:21:44 (print-webfrontend-summary) i [INF] Successfully deployed webfrontend to
https://{NAME}.{LOCATION}.azurecontainerapps.io
Open your web browser and navigate to the provided URL to see your deployed application.
The frontend displays the weather forecast data in the ASP.NET Core Blazor application.
To verify that your application is running as expected after deployment, follow the instructions for your chosen deployment target below.
When deploying to Docker Compose, the aspire deploy command displays the URLs where your services are running. Look for the print-*-summary steps in the deployment output, which show the localhost URLs for each service that has been configured with withExternalHttpEndpoints.
In the deployment output, you’ll see lines similar to the following:
Aspire CLI - Deployment summary
13:24:13 (print-env-dashboard-summary) i [INF] Successfully deployed env-dashboard to http://localhost:54633.
13:24:13 (print-app-summary) i [INF] Successfully deployed app to http://localhost:54463.
Open your web browser and navigate to the URL shown for your app (for example, http://localhost:54463) to see your deployed application.
The frontend displays the weather forecast data in a React template. In this example, both the API service and the React frontend are running within the same Docker container.
When deploying to Azure App Containers, you can verify that your Express/React application is running by navigating to the URL provided in the deployment output. Look for a line similar to the following in the output:
Aspire CLI - Deployment summary
09:25:29 (print-app-summary) i [INF] Successfully deployed app to
https://{NAME}.{LOCATION}.azurecontainerapps.io
Open your web browser and navigate to the provided URL to see your deployed application.
The frontend displays the weather forecast data in a React template. In this example, both the API service and the React frontend are running within the same Docker container.
To verify that your application is running as expected after deployment, follow the instructions for your chosen deployment target below.
When deploying to Docker Compose, the aspire deploy command displays the URLs where your services are running. Look for the print-*-summary steps in the deployment output, which show the localhost URLs for each service that has been configured with WithExternalHttpEndpoints.
In the deployment output, you’ll see lines similar to the following:
Aspire CLI - Deployment summary
(print-env-dashboard-summary)i [INF] Successfully deployed env-dashboard to http://localhost:54633.
(print-app-summary)i [INF] Successfully deployed app to http://localhost:54463.
Open your web browser and navigate to the URL shown for your app (for example, http://localhost:54463) to see your deployed application.
The frontend displays the weather forecast data in a React template. Both the Go API and the React frontend are served from the same Docker container.
When deploying to Azure App Containers, you can verify that your Go/React application is running by navigating to the URL provided in the deployment output. Look for the print-app-summary step, which reports the URL for the app resource:
Aspire CLI - Deployment summary
(print-app-summary)i [INF] Successfully deployed app to https://app.{UNIQUE-ID}.{LOCATION}.azurecontainerapps.io
Open your web browser and navigate to the provided URL to see your deployed application.
The frontend displays the weather forecast data in a React template. Both the Go API and the React frontend are served from the same container.
After deploying your application, it’s important to clean up resources to avoid incurring unnecessary costs or consuming local system resources.
Use aspire destroy to tear down the deployed environment. The command discovers the deployment, shows what will be removed, and prompts for confirmation before continuing.
You’ve just built your first Aspire app and deployed it to production. Now you might be wondering: “How do I make sure all these services actually work together correctly?” That’s where integration testing comes in. Aspire makes it easy to test your entire application stack, including service-to-service communication and resource dependencies. Ready to learn how? Write your first test
After deploying your application, it’s important to clean up resources to avoid incurring unnecessary costs or consuming local system resources.
Use aspire destroy to tear down the deployed environment. The command discovers the deployment, shows what will be removed, and prompts for confirmation before continuing.
You’ve just built your first Aspire app and deployed it to production. Now you might be wondering: “How do I make sure all these services actually work together correctly?” That’s where integration testing comes in. Aspire makes it easy to test your entire application stack, including service-to-service communication and resource dependencies. Ready to learn how? Write your first test
After deploying your application, it’s important to clean up resources to avoid incurring unnecessary costs or consuming local system resources.
Use aspire destroy to tear down the deployed environment. The command discovers the deployment, shows what will be removed, and prompts for confirmation before continuing.
You’ve just built your first Aspire app and deployed it to production. Now you might be wondering: “How do I make sure all these services actually work together correctly?” That’s where integration testing comes in. Aspire makes it easy to test your entire application stack, including service-to-service communication and resource dependencies. Ready to learn how? Write your first test