mirror of https://github.com/knative/docs.git
Further simplified the sample
This commit is contained in:
parent
a3d7f029f8
commit
647bd917d2
|
@ -18,5 +18,8 @@ RUN dotnet publish -c Release -o out
|
||||||
# This default value facilitates local development.
|
# This default value facilitates local development.
|
||||||
ENV PORT 8080
|
ENV PORT 8080
|
||||||
|
|
||||||
|
# Make sure the app binds to $PORT
|
||||||
|
ENV ASPNETCORE_URLS http://*:${PORT}
|
||||||
|
|
||||||
# Run the web service on container startup.
|
# Run the web service on container startup.
|
||||||
CMD ["dotnet", "out/helloworld-csharp.dll"]
|
CMD ["dotnet", "out/helloworld-csharp.dll"]
|
||||||
|
|
|
@ -11,13 +11,8 @@ namespace helloworld_csharp
|
||||||
CreateWebHostBuilder(args).Build().Run();
|
CreateWebHostBuilder(args).Build().Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
|
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||||
{
|
WebHost.CreateDefaultBuilder(args)
|
||||||
string port = Environment.GetEnvironmentVariable("PORT") ?? "8080";
|
.UseStartup<Startup>();
|
||||||
string url = String.Concat("http://0.0.0.0:", port);
|
|
||||||
|
|
||||||
return WebHost.CreateDefaultBuilder(args)
|
|
||||||
.UseStartup<Startup>().UseUrls(url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue