Skip to content

Instantly share code, notes, and snippets.

@bitttttten
Last active November 14, 2016 13:52
Show Gist options
  • Save bitttttten/5bd275a643cd9bda2bd8381cf5e90642 to your computer and use it in GitHub Desktop.
Save bitttttten/5bd275a643cd9bda2bd8381cf5e90642 to your computer and use it in GitHub Desktop.
image: my/nodejs-dockerfile
stages:
- test
- build
- deploy
before_script:
- ln -s /node_modules node_modules
- npm set progress=false
- npm install > npm-install.log 2>&1
test:
stage: test
only:
- develop
script:
- npm set progress=true
- node_modules/.bin/eslint app/**/*.js
- node_modules/.bin/istanbul cover --dir ./coverage ./node_modules/mocha/bin/_mocha -- -R spec --compilers js:babel-register tests/*.spec.js
- node_modules/.bin/criticalcss > criticalcss.txt
tags:
- docker
artifacts:
paths:
- coverage/
- npm-install.log
expire_in: 72 hrs
pack:
stage: build
only:
- develop
script:
- webpack -p --config webpack.config.dev.js --progress --colors
tags:
- docker
deploy:
stage: deploy
only:
- master
script:
- eval "$(ssh-agent -s)" > /dev/null 2>&1
- ssh-add <(echo "$SSH_PRIVATE_KEY") > /dev/null 2>&1
- mkdir -p ~/.ssh && echo -e "Host *\n\tStrictHostKeyChecking no\n\tLogLevel=quiet\n\n" > ~/.ssh/config
- rsync --itemize-changes --verbose --human-readable --times --checksum --recursive --delete --exclude-from=/etc/rsyncignore --delete-excluded . ssh://user@server:/path
- rc=$?; if [[ $rc != 0 ]]; then echo "rsync failed with $rc"; exit 1; fi
tags:
- docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment