简体   繁体   English

IBM Bluemix:在生产开发环境中使用NodeJ服务Angular

[英]IBM Bluemix: Serving Angular with NodeJs in Production Devops

I have an Angular app, it is served via a small NodeJs app. 我有一个Angular应用程序,它是通过一个小型NodeJs应用程序提供的。

I have a Jenkins Job who build my app and package it. 我有一个Jenkins Job,负责构建我的应用程序并将其打包。

The output artifacts are a dist directory with the angular app and the node app.js file to do the serving. 输出工件是一个dist目录,其中包含有角度的应用程序和用于执行服务的节点app.js文件。

I want now to take those artifacts to push them to bluemix. 我现在想带那些工件将它们推向bluemix。

The thing is : 事情是 :

  • You need a package.json file for cloudfoundry to detect the nodeJs buildpack 您需要cloudfoundry的package.json文件来检测nodeJs buildpack
  • When you have a package.json bluemix/cloudfoundry(?) execute npm install / build / test commands 当您拥有package.json bluemix / cloudfoundry(?)时,执行npm install / build / test命令

I already have a builded application, so I simply need to call node app.js for my app to be served. 我已经有一个已构建的应用程序,因此只需要调用node app.js即可提供我的应用程序。 And in terms of devops I would prefer to keep the Only Build Once good practice in place. 在开发方面,我希望保留“仅一次构建”的良好实践。

My current bypass is to have an empty package.json to trick bluemix. 我当前的绕过方法是使用一个空的package.json来欺骗bluemix。

So, I want to know if It's possible to deploy a node application on bluemix without needing a package.json ? 因此,我想知道是否有可能在不需要package.json情况下在bluemix上部署节点应用程序?

Or at least disable the npm commands ? 或至少禁用npm命令?

I just want bluemix/cloudfoundry(?) to do a node app.js 我只希望bluemix / cloudfoundry(?)做一个node app.js

Thanks for your help 谢谢你的帮助

There are two ways (manifest.yml and command line) to target a specific build pack. 有两种方法(manifest.yml和命令行)来定位特定的构建包。 This webpage documents the model https://docs.cloudfoundry.org/buildpacks/node/node-tips.html#discovery 该网页记录了模型https://docs.cloudfoundry.org/buildpacks/node/node-tips.html#discovery

You may also want to consider shrinkwrap ( https://docs.npmjs.com/cli/shrinkwrap ) for locking the versioning of your dependencies. 您可能还希望考虑使用rinklewrap( https://docs.npmjs.com/cli/shrinkwrap )来锁定依赖项的版本控制。

If you combine these two, I think it gets you closer to your goals. 如果将两者结合起来,我认为它使您更接近目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM