Skip to content

Instantly share code, notes, and snippets.

@ahmetkucukoglu
Last active November 19, 2019 20:08
Show Gist options
  • Save ahmetkucukoglu/205e68aa15b2602eb2d5e776889e91f4 to your computer and use it in GitHub Desktop.
Save ahmetkucukoglu/205e68aa15b2602eb2d5e776889e91f4 to your computer and use it in GitHub Desktop.
GCP Docker Image'ı Serverless Olarak Yayına Alma - Program.cs
namespace CloudRunSampleAPI
{
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using System;
public class Program
{
public static void Main(string[] args)
{
string port = Environment.GetEnvironmentVariable("PORT") ?? "8080";
string url = string.Concat("http://0.0.0.0:", port);
CreateWebHostBuilder(args, url).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args, string url) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls(url);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment