paultman
paultman

Reputation: 435

Run Grunt tasks during Bluemix deployment

I have an exciting Node app which I'd like to migrate from being hosted on Heroku to Bluemix. It's a little complicated in that the deploy runs various tasks, kicked off by a section of my package.js file:

"scripts": {
  "start": "node app.js",
  "postinstall": "grunt heroku"
},

The grunt task kicks off dependent talks found in my Gruntfile.js file, like pulling in Bower packages, minifying images, browserify, moving, files, cleaning, etc.

I assume I can kick off deploy tasks when pushing to Bluemix? If so, would they just be done in a similar fashion (commands in scripts section of package.json) to run tasks defined in my Gruntfile.js?

In heroku, my entire git repo would be replicated to their remote, so everything was there, not just the output of running scripts to product a dist directory, I assume that would be the same on Bluemix?

Last, in my package file, I would define npm and node versions:

"engines": {
  "npm": "2.5.1",
  "node": "0.12.0"
}

and Heroku would ensure that it's running that version specific to my instance. Is it the same for Bluemix?

Thank you very much! Paul

Upvotes: 1

Views: 726

Answers (1)

Sai Vennam
Sai Vennam

Reputation: 567

In Bluemix, the npm install command is run to install your dependencies. This will kick-off your grunt heroku task in the postinstall section. Note that your devDependencies will not be downloaded. In case your grunt task requires them, they may need to be moved to the dependencies section.

Right, your entire application repository that you have pushed will be replicated on Bluemix, similar to Heroku.

You can now specify the Node and NPM engine, as you have it in your package.json.

Outdated: You can certainly specify the node engine, just like you have it in your example. However, the NPM version is currently not configurable, and is instead provided by what is packaged within that Node.js runtime.

Upvotes: 7

Related Questions