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

查看:24
本文介绍了使用来自 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天全站免登陆