public void DeployApp(string app) { var manifestPath = Path.Combine(_context.ProjectDirectory, CloudFoundryManifestFile.DefaultFileName); if (File.Exists(manifestPath)) { File.Delete(manifestPath); } var manifestFile = new CloudFoundryManifestFile(manifestPath); manifestFile.CloudFoundryManifest.Applications.Add(new CloudFoundryManifest.Application { Name = app, Command = $"cmd /c .\\{Path.GetFileName(_context.ProjectDirectory)}", BuildPacks = new List <string> { "binary_buildpack" }, Stack = "windows2016", Memory = "512M", Environment = new Dictionary <string, string> { { "ASPNETCORE_ENVIRONMENT", "development" } }, ServiceNames = _context.Configuration.GetServices() } ); manifestFile.Store(); _dotnetCli.Run("publish -f netcoreapp2.1 -r win10-x64", "publishing app"); _cfCli.Run( $"push -f {CloudFoundryManifestFile.DefaultFileName} -p bin/Debug/netcoreapp2.1/win10-x64/publish", "pushing app to Cloud Foundry"); }
public void DeployApp(string app) { var manifestPath = Path.Combine(_context.ProjectDirectory, CloudFoundryManifestFile.DefaultFileName); if (File.Exists(manifestPath)) { File.Delete(manifestPath); } var cloudFoundryApp = new CloudFoundryManifest.Application(); cloudFoundryApp.Name = app; cloudFoundryApp.Memory = "512M"; cloudFoundryApp.Environment = new Dictionary <string, string> { { "ASPNETCORE_ENVIRONMENT", "development" } }; cloudFoundryApp.ServiceNames = _context.Configuration.GetServices(); if (_context.Configuration.Apps[app].TargetRuntime.StartsWith("ubuntu")) { cloudFoundryApp.BuildPacks = new List <string> { "dotnet_core_buildpack" }; cloudFoundryApp.Command = $"cd ${{HOME}} && ./{Path.GetFileName(_context.ProjectDirectory)}"; } else { cloudFoundryApp.Stack = "windows"; cloudFoundryApp.BuildPacks = new List <string> { "hwc_buildpack" }; cloudFoundryApp.Command = $"cmd /c .\\{Path.GetFileName(_context.ProjectDirectory)}"; } var manifestFile = new CloudFoundryManifestFile(manifestPath); manifestFile.CloudFoundryManifest.Applications.Add(cloudFoundryApp); manifestFile.Store(); var framework = _context.Configuration.Apps[app].TargetFramework; var runtime = _context.Configuration.Apps[app].TargetRuntime; _dotnetCli.Run($"publish -f {framework} -r {runtime}", "publishing app"); _cfCli.Run( $"push -f {CloudFoundryManifestFile.DefaultFileName} -p bin/Debug/{framework}/{runtime}/publish", "pushing app to Cloud Foundry"); }