将.NET Core应用程序部署为Dockerized容器的好处? [英] Benefits of deploying .NET Core App as a Dockerized Container?

查看:54
本文介绍了将.NET Core应用程序部署为Dockerized容器的好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用PostgreSQL数据库和ReactJS前端进行.NET Core Web API项目.

I have been working on a .NET Core Web API project with a PostgreSQL database and a ReactJS front-end.

我正在计划在Azure上运行/部署.我已经创建了一个PostgreSQL实例,并对其进行了代码优先的迁移.

I am planning on running / deploying on Azure. I have already created a PostgreSQL instance and applied my code-first migrations to this.

下一步是将我的Web API项目部署到Azure ...我知道当前关于Docker容器的讨论很多,而且我非常热衷于使用这项技术.

The next step is deploying my Web API project to Azure... I know there is a lot of buzz around Docker containers currently and I was keen to have a play with this tech.

我的问题是,与按原样部署VS部署容器相比,我会收到任何好处吗?

My question is, would I receive any benefits deploying a container VS deploying as is?

推荐答案

当涉及到继续集成(CI)/继续部署(CD)时,可以突出显示项目容器化的一个好处.

One benefit of containerization of your project can be highlighted when it comes to continues integration (CI) / continues deployment (CD).

假设您有3个需要部署Web应用程序的环境,DEV(开发和测试的地方),TEST(测试人员和/或业务测试的地方),PROD(实现和/或使用应用程序的地方)).您可以将在DEV中内置的相同容器部署到TEST和PROD.现在,假设您正在使用TFS之类的代码存储库来存储源代码.您可以配置TFS,以便在签入代码时,它将使用容器定义(dockerfile)为您构建容器,并将其部署在指定的环境中.容器化可确保部署到DEV的同一代码与部署在TEST或PROD上的代码以相同的方式工作,因为您的代码需要/依赖的所有内容都在容器中.

Let’s say you have 3 environments where you need to deploy your web app, DEV(Where you develop and test), TEST(Where testers and/or the business test), PROD(Where your application is implemented and/or used). The same container that you built in DEV can be deployed to TEST and PROD. Now let’s say you’re using a code repo like TFS to store your source code. You can configure TFS so that when you check-in your code, it will build the container for you using your containers definition (dockerfile) and deploy it for you on the environment you specify. Containerization makes sure that the same code that is deployed to DEV would work the same way as the code deployed on TEST or PROD because everything that your code requires/dependent on are in the container.

CI/CD对此有好处,因为您可以确保所涉及的所有自动化操作都将产生一个无论环境如何都可以工作的容器.

CI/CD benefits on this because you can be sure that all the automation involved will produce a container that would work regardless of the environment.

这篇关于将.NET Core应用程序部署为Dockerized容器的好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆