Created
September 13, 2024 17:43
-
-
Save alaye-ms/f8963137ff62bb882c0ed45f5f655fe3 to your computer and use it in GitHub Desktop.
Using a different image for Aspire CosmosDB emulator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The RunAsEmulator function mostly serves as a wrapper around adding the container image and port with a specific "emulator" name | |
so it can be replaced by that call and whatever emulator is being used. | |
It'll be important to run `docker pull` on the image you use, and also I needed to run `dotnet dev-certs https --trust` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var builder = DistributedApplication.CreateBuilder(args); | |
var database = builder.AddAzureCosmosDB("cosmos").AddDatabase("iotdb") | |
//.RunAsEmulator() | |
.WithEndpoint(name: "emulator", targetPort: 8080) | |
.WithAnnotation(new ContainerImageAnnotation | |
{ | |
Registry = "<registry name>", | |
Image = "<image name>", | |
Tag = "<tag>" | |
}); | |
var apiService = builder.AddProject<Projects.AspireWithCosmos_ApiService>("apiservice") | |
.WithReference(database); | |
builder.AddProject<Projects.AspireWithCosmos_Web>("webfrontend") | |
.WithExternalHttpEndpoints() | |
.WithReference(apiService); | |
builder.Build().Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment