Skip to content

jthomas/nodejs-buildpack

 
 

Repository files navigation

CloudFoundry build pack: Node.js

A Cloud Foundry buildpack for Node based apps.

This is based on the [Heroku buildpack] (https://github.com/heroku/heroku-buildpack-nodejs).

Additional documentation can be found at the CloundFoundry.org.

Usage

This buildpack will get used if you have a package.json file in your project's root directory.

cf push my_app -b https://github.com/cloudfoundry/buildpack-nodejs.git

Disconnected environments

To use this buildpack on Cloud Foundry, where the Cloud Foundry instance limits some or all internet activity, please read the Disconnected Environments documentation.

Vendoring app dependencies

As stated in the Disconnected Environments documentation, your application must 'vendor' it's dependencies.

For the NodeJS buildpack, use npm:

cd <your app dir>
npm install # vendors into /node_modules

cf push uploads your vendored dependencies.

Additional extensions

In cached mode, use the semver node_module (as opposed to https://semver.io) to resolve the correct node version. The semver.io service has an additional preference for stable versions not present in the node module version. We wrap the node module using lib/version_resolver.js to add back this functionality.

Building

  1. Make sure you have fetched submodules
git submodule update --init
  1. Get latest buildpack dependencies
BUNDLE_GEMFILE=cf.Gemfile bundle
  1. Build the buildpack
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager [ online | offline ]
  1. Use in Cloud Foundry

Upload the buildpack to your Cloud Foundry and optionally specify it by name

cf create-buildpack custom_node_buildpack node_buildpack-offline-custom.zip 1
cf push my_app -b custom_node_buildpack

Contributing

Run the tests

See the Machete CF buildpack test framework for more information.

Pull Requests

  1. Fork the project
  2. Submit a pull request

Reporting Issues

Open an issue on this project

Active Development

The project backlog is on Pivotal Tracker

About

Cloud Foundry buildpack for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 70.2%
  • Ruby 21.4%
  • JavaScript 8.4%