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

Add support for ExposedPorts to the Image config #113

Merged
merged 8 commits into from
Sep 14, 2022
Merged

Add support for ExposedPorts to the Image config #113

merged 8 commits into from
Sep 14, 2022

Conversation

baronfel
Copy link
Member

This is a fairly mechanical transformation. Things remaining to do:

  • tests to verify the addition of the default aspnetcore port declarations (or not, as appropriate)
  • tests to verify deduping
  • add warnings for malformed ContainerPort Items

@baronfel
Copy link
Member Author

Part of #93 and #112

@baronfel
Copy link
Member Author

For a test asp.net core container, we now have ExposedPorts:

"ExposedPorts": {
    "80/tcp": {}
}

and we can see the ports being automatically bound when -P is used:

➜ docker ps
CONTAINER ID   IMAGE                      COMMAND                  CREATED         STATUS         PORTS                   NAMES
a41168f7eac0   container-app-tres:0.0.4   "/app/container-app-…"   5 seconds ago   Up 4 seconds   0.0.0.0:49153->80/tcp   wonderful_faraday

and indeed, navigating to that port shows the app.

benvillalobos
benvillalobos previously approved these changes Aug 19, 2022
Copy link
Member

@benvillalobos benvillalobos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm, my biggest gripe is testing. Won't block on it if we need to merge & create an issue for that

Microsoft.NET.Build.Containers/ContainerHelpers.cs Outdated Show resolved Hide resolved
Microsoft.NET.Build.Containers/ContainerHelpers.cs Outdated Show resolved Hide resolved
Microsoft.NET.Build.Containers/CreateNewImage.cs Outdated Show resolved Hide resolved
@baronfel
Copy link
Member Author

I made significant enough changes to the port parsing to warrant a re-review, but I did add a crap ton of testing to the core logic. Also went ham on the user-facing errors.

@baronfel baronfel dismissed benvillalobos’s stale review August 22, 2022 02:45

Large enough changes to warrant re-review.

@baronfel baronfel added this to the 7.0.100-rc1 milestone Sep 13, 2022
@baronfel
Copy link
Member Author

Rebased this on top of latest main - the only actual change was to flow ports through the containerize CLI, reusing the existing parse helpers to do CLI argument validation and flowing the validated values into Image creation inside the ContainerHelpers factory method.

@baronfel
Copy link
Member Author

@benvillalobos when this merges we'll want to take care and make sure that the new tool task also handles writing port arguments to the CLI.

@baronfel baronfel enabled auto-merge (squash) September 14, 2022 14:02
@baronfel baronfel merged commit e98d757 into main Sep 14, 2022
@baronfel baronfel deleted the ports branch September 14, 2022 14:04
baronfel added a commit that referenced this pull request Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants