Announcing built-in container support for the .NET SDK - .NET Blog
The .NET 7 SDK can easily build containers from your existing applications through new container image building support.
dotnetでのコンテナの構成がdotnetコマンドで可能になり、よりdotnet開発者的には手軽になりました。
# create a new project and move to its directory
dotnet new mvc -n my-awesome-container-app
cd my-awesome-container-app
# add a reference to a (temporary) package that creates the container
dotnet add package Microsoft.NET.Build.Containers
# publish your project for linux-x64
dotnet publish --os linux --arch x64 -p:PublishProfile=DefaultContainer
# run your app using the new container
docker run -it --rm -p 5010:80 my-awesome-container-app:1.0.0
これだけでDocker runまでいけます。
コメント