-
Notifications
You must be signed in to change notification settings - Fork 440
/
Copy pathProgram.cs
28 lines (19 loc) · 850 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var builder = DistributedApplication.CreateBuilder(args);
var migrateOperation = builder.AddTodoDbMigration();
var todoapi = builder.AddProject<Projects.Todo_Api>("todoapi");
builder.AddProject<Projects.Todo_Web_Server>("todo-web-server")
.WithReference(todoapi);
var dbDirectory = Path.Combine(todoapi.GetProjectDirectory(), ".db");
// Add sqlite-web to view the Todos.db database
var sqliteWeb = builder.AddContainer("sqliteweb", "tomdesinto/sqliteweb")
.WithHttpEndpoint(targetPort: 8080)
.WithBindMount(dbDirectory, "/db")
.WithArgs("Todos.db")
.ExcludeFromManifest();
if (migrateOperation is not null)
{
// Wait for the migration to complete before running the api and ui
todoapi.WaitForCompletion(migrateOperation);
sqliteWeb.WaitForCompletion(migrateOperation);
}
builder.Build().Run();