Node.js image for CircleCI 2.0 with Heroku CLI
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Dockerfile
README.md

README.md

docker-heroku-nodejs-ci

Node.js image for CircleCI 2.0 with Heroku CLI

Setup

ref: https://circleci.com/docs/2.0/project-walkthrough/#deployment-

.circleci/setup-heroku.sh

#!/bin/bash

set -eu

git remote add heroku https://git.heroku.com/$HEROKU_APP_NAME.git

cat > ~/.netrc << EOF
machine api.heroku.com
	login $HEROKU_LOGIN
	password $HEROKU_API_KEY
machine git.heroku.com
	login $HEROKU_LOGIN
	password $HEROKU_API_KEY
EOF

# Add heroku.com to the list of known hosts
ssh-keyscan -H heroku.com >> ~/.ssh/known_hosts

.circleci/config.yml

version: 2
jobs:
  build:
    working_directory: /app/user
    docker:
      - image: atsnngs/heroku-nodejs-ci:latest
    steps:
      - checkout
      - restore_cache:
          key: node_modules-{{ .Branch }}-{{ checksum "package.json" }}
      - run:
          command: npm install
      - save_cache:
          key: node_modules-{{ .Branch }}-{{ checksum "package.json" }}
          paths:
            - node_modules
      - run:
          command: npm test
      - run:
          command: |
            if [ "${CIRCLE_BRANCH}" == "master" ]; then
              ./.circleci/setup-heroku.sh
              git push heroku HEAD:master
            fi