Cloudfoundry : How to combine two runtimes

2019-07-12 18:26发布

问题:

Is there a way in cloundfoundry to combine two runtime environments? I am deploying a NodeJS app to IBM Bluemix. Now, i also want to be able to execute a standalone jar file but the app fails

APP/0/bin/sh: 1: java: not found

which i guess makes sense as the app was deployed with a Nodejs SDK runtime. I tried to look at some resources

https://docs.cloudfoundry.org/adminguide/buildpacks.html

and

https://developer.ibm.com/answers/questions/16115/use-multiple-buildpacks-on-your-app.html

but I could not understand much yet. Is there a straightforward way to have both the NodeJS and Java runtime in a Bluemix app?

回答1:

In short - you need to create custom buildpack and use it for application deployment or grab one of the community combined buildpacks.

Have a look on https://github.com/syahrul-aiman/nodejs-java-buildpack for example.



回答2:

If you don't want to mess with forking a build pack, which is an ongoing maintenance burden, you could try using this multi build pack or the fork of the old Heroku multi build pack. These both let you specify multiple build packs to run, so in your case you'd include both the Java build pack and the NodeJS build pack (they'll run in that order).

There is also currently a proposal for the platform to support multi build packs natively. You can see that here. When this is available, it will remove the need to use the multi build pack, build packs above.