34 lines
996 B
C#
34 lines
996 B
C#
using Microsoft.Extensions.Hosting;
|
|
using Vegasco.Server.AppHost.Shared;
|
|
|
|
IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(args);
|
|
|
|
IResourceBuilder<PostgresServerResource> postgresBuilder = builder.AddPostgres(Constants.Database.ServiceName)
|
|
.WithLifetime(ContainerLifetime.Persistent)
|
|
.WithDataVolume();
|
|
|
|
if (builder.Environment.IsDevelopment())
|
|
{
|
|
postgresBuilder = postgresBuilder
|
|
.WithPgWeb()
|
|
.WithPgAdmin();
|
|
}
|
|
|
|
IResourceBuilder<PostgresDatabaseResource> postgres = postgresBuilder
|
|
.AddDatabase(Constants.Database.Name);
|
|
|
|
IResourceBuilder<ProjectResource> api = builder
|
|
.AddProject<Projects.Vegasco_Server_Api>(Constants.Projects.Api)
|
|
.WithReference(postgres)
|
|
.WaitFor(postgres);
|
|
|
|
builder
|
|
.AddNpmApp("Vegasco-Web", "../Vegasco-Web", scriptName: "start:withInstall")
|
|
.WithReference(api)
|
|
.WaitFor(api)
|
|
.WithHttpEndpoint(port: 44200, env: "PORT", isProxied: false)
|
|
.WithExternalHttpEndpoints()
|
|
.WithHttpHealthCheck("/", 200);
|
|
|
|
builder.Build().Run();
|