Deploying An Angular application using continuous integration from git or gitLab

故事扮演 提交于 2019-12-21 05:39:11

问题


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

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

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


回答1:


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

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/

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.

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)

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

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



来源:https://stackoverflow.com/questions/47315228/deploying-an-angular-application-using-continuous-integration-from-git-or-gitlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!