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 user defined entrypoint in containers #1341

Merged
merged 2 commits into from
Dec 27, 2023

Conversation

BrennanConroy
Copy link
Member

@BrennanConroy BrennanConroy commented Dec 11, 2023

Should we add more AddContainer overloads for entrypoint? Should we add a WithEntrypoint extension method?

Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Dec 11, 2023
@DamianEdwards
Copy link
Member

Did you... read my mind? #1342

@@ -578,6 +578,11 @@ private async Task CreateContainersAsync(IEnumerable<AppResource> containerResou
}
}

if (modelContainerResource is ContainerResource containerResource)
{
dcpContainerResource.Spec.Command = containerResource.Entrypoint;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it? I don't have visibility into what command maps to internally in dcp, but I was told this is for entrypoint.

Copy link
Member

Choose a reason for hiding this comment

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

That's a question for @karolz-ms

Copy link
Member

Choose a reason for hiding this comment

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

DCP is attempting to bypass the whole command vs entrypoint madness, it has just one option, Command which if set, that is the binary that will be run, no exceptions. So it is the equivalent of --entrypoint (and --entrypoint is the option that is used under the covers with Docker).

Copy link
Member

Choose a reason for hiding this comment

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

I see. So with DCP it's currently not possible to just pass args to a container's pre-defined entry point?

Copy link
Member

Choose a reason for hiding this comment

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

It is, you just use Args property for that

Copy link
Member

Choose a reason for hiding this comment

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

Ok it makes sense now. I was confused how this was working using just the existing WithArgs method, but it turns out it's because the mssql container is defined like this:
image

@BrennanConroy BrennanConroy marked this pull request as ready for review December 21, 2023 19:28
@BrennanConroy BrennanConroy merged commit 2a198d5 into main Dec 27, 2023
8 checks passed
@BrennanConroy BrennanConroy deleted the brecon/command branch December 27, 2023 22:21
@BrennanConroy BrennanConroy added this to the preview 3 (Jan) milestone Dec 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants