Skip to content

Instantly share code, notes, and snippets.

@germanattanasio
Created July 7, 2017 12:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save germanattanasio/4b29c9e9877ed8a444e179ae24b26c7e to your computer and use it in GitHub Desktop.
Save germanattanasio/4b29c9e9877ed8a444e179ae24b26c7e to your computer and use it in GitHub Desktop.
Deploy a Node.js Cloud-Foundry application to IBM Bluemix from Travis
---
applications:
- name: my-app-name
buildpack: sdk-for-nodejs
memory: 512M
timeout: 120 # The maximum amount of time in seconds that is used to start the application. The default value is 60 seconds.
instances: 1
command: npm start
path: .
#!/bin/bash
# Deploy a Travis job to Bluemix
# Organization and Space can be specified, otherwise we will use a default value
set -e
if [[ -n "$CF_USERNAME" && -n "$CF_PASSWORD" ]]; then
# Use the URL to a Debian 64 bit installer select from here:
# https://github.com/cloudfoundry/cli/releases
# This is the source file after following the redirect
wget https://s3.amazonaws.com/go-cli/releases/v6.28.0/cf-cli_amd64.deb -qO temp.deb && sudo dpkg -i temp.deb
rm temp.deb
# MyOrganization will be the default value
CF_ORGANIZATION=${CF_ORGANIZATION:-MyOrganization}
# MySpace will be the default value
CF_SPACE=${CF_SPACE:-MySpace}
cf api https://api.ng.bluemix.net
cf login --u $CF_USERNAME --p $CF_PASSWORD --o $CF_ORGANIZATION --s $CF_SPACE
BRANCH_NAME=$(echo $TRAVIS_BRANCH | sed -e 's/[^A-Za-z0-9._-]/-/g')
STAGE_APP_NAME="my-app-name-`dirname $TRAVIS_REPO_SLUG`-${BRANCH_NAME}"
cf push -f manifest.yml $STAGE_APP_NAME -n $STAGE_APP_NAME
else
echo "Skip deploy to Bluemix because CF_USERNAME or CF_PASSWORD are empty"
exit 1
fi
language: node_js
sudo: required
node_js: 6
cache:
directories:
- node_modules
deploy:
- provider: script
script: ./travis.sh
skip_cleanup: true
on:
all_branches: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment