# This file is a template, and might need editing before it works on your project.
|
|
# Official framework image. Look for the different tagged releases at:
|
|
# https://hub.docker.com/r/library/node/tags/
|
|
image: node:latest
|
|
|
|
cache:
|
|
paths:
|
|
- node_modules/
|
|
|
|
before_script:
|
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
|
- eval $(ssh-agent -s)
|
|
- echo "$SSH_PRIV_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
|
- mkdir -p ~/.ssh
|
|
- chmod 700 ~/.ssh
|
|
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
|
|
|
|
stages:
|
|
- test
|
|
- deploy
|
|
|
|
test_coverage:
|
|
stage: test
|
|
script:
|
|
- npm install
|
|
- npm install --global mocha nyc
|
|
- npm run coverage
|
|
|
|
deploy_prod:
|
|
stage: deploy
|
|
script:
|
|
- echo "Deploying to Production"
|
|
- npm install
|
|
- ssh root@68.183.173.226 "cd /opt/website && git pull && npm install && bash -c \"pm2 stop LeviOlson && pm2 delete LeviOlson && pm2 start app.js --name LeviOlson --watch && pm2 logs --nostream --lines 2 LeviOlson && exit 0\" && exit 0"
|
|
environment:
|
|
name: production
|
|
url: https://leviolson.com
|
|
only:
|
|
- master
|