Open baronfel opened 1 year 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).
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.
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 usedocker 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:func init --dotnet
=> generate a new project that includes a PackageReference to the Azure Functions NuGet with these customizationsfunc deploy kubernetes ...
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 imageMore 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!