Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.3k stars 430 forks source link

Consider supporting the .NET SDK built-in deploy/init #3355

Open baronfel opened 1 year ago

baronfel commented 1 year ago

Currently all functions deployments go through a three-step approach:

I'd like to propose supporting the built-in containerization tech that the .NET SDK has. The 7.0 series of .NET SDKs has a mechanism that allows for creating and pushing containers through dotnet publish instead of having to use docker build, and this mechanism doesn't require manipulating Dockerfiles in any way, nor does it require a container builder like Docker to create the containers. It's very similar to Jib or Ko in the Java and Go ecosystems.

The SDK feature allows for complete customization of the resulting container, including selection of base images, environment variables, etc. This can be made even more seamless to the end user by shipping Func's defaults/properties in a NuGet package that seamlessly applies the defaults. An example of what that looks like is in a Gist I made.

If this were packaged in a NuGet, the overall lifecycle of a .NET func user might look like:

More resources to learn about the tech can be found

And I can be reached via Teams or internal email (alias is chethusk) for any follow-up. I look forward to discussing this more with you all!

baronfel commented 4 months ago

Since I logged this issue the tech has advanced - the .NET 8 SDK can natively containerize any kind of project via the /t:PublishContainer target, and can push that generated container to a wide variety of supported registries (including Azure container registries).

mattchenderson commented 2 months ago

This is a good item - thanks for opening it and for following up with updates!

This will require some prerequisite work items across some of our other repos.

I suspect we'd also want some kind of warning or info log that points to this support if a user ran func init --docker-only or the --docker flag as well, though I don't think we'd block the gesture itself.

Edit: I filed https://github.com/Azure/azure-functions-dotnet-worker/issues/2617 as a pre-requisite to work here.