Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert adopting ASPNETCORE_HTTP_PORTS. #474

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions 8.0/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ a `.s2i/environment` file inside your source code repository.
`Release` or `Debug`. This is passed to the `dotnet publish` invocation.
Defaults to `Release`.

* **ASPNETCORE_HTTP_PORTS**
* **ASPNETCORE_URLS**

This variable is set to `8080` to configure ASP.NET Core to use the port exposed by the image.
This variable is set to `http://*:8080` to configure ASP.NET Core to use the
port exposed by the image.

* **HTTP_PROXY, HTTPS_PROXY**

Expand Down
2 changes: 1 addition & 1 deletion 8.0/runtime/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ENV HOME=/opt/app-root \
# Don't download/extract docs for nuget packages
NUGET_XMLDOC_MODE=skip \
# Configure ASP.NET Core to use the exposed port
ASPNETCORE_HTTP_PORTS=8080 \
ASPNETCORE_URLS=http://*:8080 \
# Like Microsoft images, set APP_UID to the UID of the non-root user.
APP_UID=1001

Expand Down
6 changes: 3 additions & 3 deletions 8.0/runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ Environment variables
The following variables are set so they can be used from scripts.
They must not to be overridden.

* **ASPNETCORE_HTTP_PORTS**
* **ASPNETCORE_URLS**

This variable is set to `8080` to configure ASP.NET Core to use the port exposed by the image.
This variable is set to `http://*:8080` to configure ASP.NET Core to use the
port exposed by the image.

* **DOTNET_APP_PATH,DOTNET_DEFAULT_CMD,DOTNET_DATA_PATH**

Expand All @@ -96,4 +97,3 @@ They must not to be overridden.

Like Microsoft images, this is set to the rootless user's uid to enable switching to that user
in a Dockerfile using the the instruction: `USER $APP_UID`.
.
22 changes: 17 additions & 5 deletions 8.0/runtime/test/aspnet-hello-world/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;

app.MapGet("/", () => "Hello World!");

app.Run();
namespace AspNetHelloWorld
{
public class Program
{
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.Configure(a => a.Run(c => c.Response.WriteAsync("Hello World!")))
.Build()
.Run();
}
}
}
Binary file modified 8.0/runtime/test/aspnet-hello-world/app.tar.gz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions 8.0/runtime/test/run
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ test_port() {

# Port 8080 is exposed
assert_equal $(docker_get_exposedports $IMAGE_NAME) '{"8080/tcp":{}}'
# The environment variable used by ASP.NET Core matches the exposed port.
assert_equal $(docker_get_env $IMAGE_NAME ASPNETCORE_HTTP_PORTS) "8080"
# The environment variable used by ASP.NET Core matches
assert_equal $(docker_get_env $IMAGE_NAME ASPNETCORE_URLS) "http://*:8080"
}

verify_aspnet_image_works() {
Expand Down