使用来自git或gitLab的持续集成来部署Angular应用程序 [英] Deploying An Angular application using continuous integration from git or gitLab

查看:143
本文介绍了使用来自git或gitLab的持续集成来部署Angular应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过apache服务器上的bitbucket进行持续集成来部署Angular 5应用程序

I am looking to deploy Angular 5 application with continuous integration from bitbucket on an Apache server

现在,因为我是该领域的新手,所以我不知道执行此操作的可能选择

Now because I am new to the field, I am unaware of the possible options to do this

就像我们需要将Webpack与Jenkins集成一样,还是需要在Jenkins上编写其他代码,或者我们可以在没有Jenkins的情况下做到这一点,是否需要将其与Sonar集成在一起?

Like do we need to integrate webpack with Jenkins, or do we need to write some other code on Jenkins, or we can do it without Jenkins and do we need to integrate it along with Sonar

有些页面没有提供有关webpack的任何线索,而有些页面则说您只需要用Jenkins编写webpack脚本即可.

Some pages do not give any clue about webpack, while some say you just have to write webpack script in Jenkins

任何对此有经验的人,请赐教

Anyone having experience in this, please enlighten us

推荐答案

如果您使用angular cli来构建应用程序,则可以直接通过jenkins/teamcity进行操作.

If you are using angular cli to building the application, then its pretty straight forward to do the same via jenkins/teamcity.

在jenkins上安装节点js- https://wiki.jenkins.io/display /JENKINS/NodeJS +插件 此外,您可以关注此博客- https://blog.couchbase. com/create-continuous-deployment-pipeline-nodejs-jenkins/

Install node js on jenkins - https://wiki.jenkins.io/display/JENKINS/NodeJS+Plugin Further you can follow this blog - https://blog.couchbase.com/create-continuous-deployment-pipeline-nodejs-jenkins/

特定于angular 2/4/5-您只需要通过shell脚本传递angular CLI命令,并将生成的构建推向所需的服务器即可.

Specific to angular 2/4/5 -You just need to pass the angular CLI commands via shell script and push the build generated towards the desired server.

类似-ng build 这样,您还可以使用以下标志 1.'--prod'-大大减少了构建大小,因为它消除了使用树状摇动时的死代码 2.'--build-optimizer'-执行进一步的代码优化,例如,删除装饰器等(与angular 5,CLI 1.5兼容)

Something like - ng build With that you can use following flags as well 1. '--prod' - reduces the build size considerably, as it eliminates dead code while using tree shaking 2. '--build-optimizer' - it performs further code optimization, e.g removing decorators etc (works with angular 5, CLI 1.5)

命令类似于-ng build --prod --build-optimizer

Command will look something like - ng build --prod --build-optimizer

有关更多信息,您可以阅读Wiki- https://github.com /angular/angular-cli/wiki/build

For more in-depth you can read wiki - https://github.com/angular/angular-cli/wiki/build

这篇关于使用来自git或gitLab的持续集成来部署Angular应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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