Azure / Azure/azure-functions-core-tools

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

Open
#3,355 4 comments 1 reaction 0 assignees View on GitHub
design
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

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

* build a container
* push the container to a registry
* optionally deploy the newly-pushed container via a specific platform

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](https://gist.github.com/baronfel/e97f46933d05365ea93d7855af742e58).

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

* `func init --dotnet` => generate a new project that includes a PackageReference to the Azure Functions NuGet with these customizations
* `func deploy kubernetes ...`
* invoke `dotnet publish -c Release -r linux-x64 -p PublishProfile=DefaultContainer` and any additional properties that specify registry (for example `-p ContainerRegistry=foo.azurecr.io`, or `-p ContainerImageName=mycustomfunctionname` and let the SDK create and push the generated image
* invoke the platform-specific (kubernetes in this case) deploy step

More resources to learn about the tech can be found
* [at our repo](https://github.com/dotnet/sdk-container-builds)
* [in published docs](https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container)

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!

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `func init --dotnet` and `func deploy kubernetes` entry points, then compare their current lifecycle with the .NET SDK container-build resources linked in the issue. Done means .NET projects can use SDK-driven container creation and publishing before the platform-specific deployment step, with the proposed defaults applied through a NuGet package.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, kubernetes
Domain
cli, cloud, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.