Commit 4c884367 authored by Eric Eastwood's avatar Eric Eastwood

Update gitlab-ci for deployment v1

parent e771253e
Pipeline #6325200 (#) failed with stages
in 6 minutes and 53 seconds
......@@ -12,6 +12,22 @@ stages:
before_script:
- node --version
- npm --version
# See https://docs.gitlab.com/ee/ci/ssh_keys/README.html
# -----------------------------------------------------------
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY")
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
build:
stage: build
......@@ -20,9 +36,9 @@ build:
artifacts:
paths:
- node_modules/
#- dist/ # Generated during the server startup
tags:
- nodejs-app
- docker
- shared
test:
......@@ -30,12 +46,22 @@ test:
script:
- npm run lint
tags:
- nodejs-app
- docker
- shared
deploy:
stage: deploy
script:
- 'echo "TODO: Deploy"'
- rsync -r --delete-after --quiet . $SSH_USER@$DEPLOY_HOST::/var/www/apilab
- ssh $SSH_USER@$DEPLOY_HOST <<EOF
pm2 restart apilab
EOF
environment:
name: production
url: https://apilab.gitlab.org
only:
- master
tags:
- nodejs-app
- docker
- shared
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment