Closed baronfel closed 11 months ago
@baronfel as a heads up, this is the parser from the aspnetcore project for parsing the entries in ASPNETCORE_URLS: https://github.com/dotnet/aspnetcore/blob/main/src/Http/Http/src/BindingAddress.cs
@danegsta one concern I have with using their parser is that it changes the runtime requirements of our MSBuild Tasks. Before they worked with just the basic .NET runtime installed. Using the AspNet parser directly for this would start requiring the Microsoft.AspNetcore.App FrameworkReference, which might have implications. I'll figure it out with the team though.
Yeah, this is going to be A Thing :tm:
@baronfel the main complication comes from the fact that the URLs they use aren't always real valid URLs; they use special characters to represent binding to any address (usually noted with 0.0.0.0
elsewhere), so http://+:80;https://+:443
is a totally valid ASPNETCORE_URLS value. You can probably get away with simple split on ';' plus a simple regex to match <protocol>://<host like value>:<port>
and call it a day.
ASP.NET has a few environment variables that control which ports/urls are used for hosting the application
We should check for these in the environment block of an application, and attempt to define
ExposedPort
metadata for any ports found there.ASPNETCORE_HTTP_PORTS
andASPNETCORE_HTTPS_PORTS
have a simple syntax of semicolon-delimited port numbers, butASPNETCORE_URLS
has a format of semicolon-delimited{scheme}://{address}:{port}
items, whereaddress
is one of:localhost
*
Creating these ports allows other tooling like the VSCode Docker tooling to automatically detect and expose ports when users run our containers.