Skip to content

Instantly share code, notes, and snippets.

@AndrewBestbier
Last active October 15, 2019 21:36
Show Gist options
  • Save AndrewBestbier/dee37aafb7a2333087c3be356805d9eb to your computer and use it in GitHub Desktop.
Save AndrewBestbier/dee37aafb7a2333087c3be356805d9eb to your computer and use it in GitHub Desktop.
version: 2
jobs:
test:
working_directory: ~/app
docker:
- image: circleci/node:latest # (1)
steps:
- checkout
- run:
name: Update npm
command: 'sudo npm install -g npm@latest'
- restore_cache: # (2)
key: dependency-cache-{{ checksum "package-lock.json" }}
- run:
name: Install npm dependencies
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
- run:
name: Run tests # (3)
command: 'npm run test'
docker-deploy-image:
working_directory: ~/app
machine:
docker_layer_caching: true # (4)
steps:
- checkout
- run: | # (5)
docker build -t andrewbestbier/ci-comparison-blog .
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push andrewbestbier/ci-comparison-blog
deploy-aws:
working_directory: ~/app
docker:
- image: circleci/python:latest
steps:
- checkout
- run: # (6)
name: Installing deployment dependencies
working_directory: /
command: 'sudo pip install awsebcli --upgrade'
- run: # (7)
name: Deploying application to Elastic Beanstalk
command: eb deploy
workflows:
version: 2
build-test-and-deploy:
jobs:
- test
- docker-deploy-image:
requires:
- test
- deploy-aws:
requires:
- docker-deploy-image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment