Sign inSign up

atsnngs/heroku-nodejs-ci

By atsnngs

•Updated over 9 years ago

Node.js image for CircleCI 2.0 with Heroku CLI

Image
1

492

atsnngs/heroku-nodejs-ci repository overview

⁠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

Tag summary

Content type

Image

Digest

Size

544.1 MB

Last updated

over 9 years ago

docker pull atsnngs/heroku-nodejs-ci