Skip to content

Instantly share code, notes, and snippets.

@Mozartted
Last active October 20, 2017 18:49
Show Gist options
  • Save Mozartted/e06a8b83c8beee0bb294236a8f0cb001 to your computer and use it in GitHub Desktop.
Save Mozartted/e06a8b83c8beee0bb294236a8f0cb001 to your computer and use it in GitHub Desktop.
Gitlab continuous integrations configs for Laravel App Deployment
stages:
- test
- deploy
# So this is where I deploy to server to build the site
deploy-master:
stage: deploy
image: tetraweb/php:7.0
before_script:
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh deployer@YOUR_SERVERIP_HERE "cd /var/www/project/ && git checkout . && git checkout master && git pull && cp .env.example .env && composer install && php artisan migrate "
environment:
name: production
only:
refs:
- master
tags:
- live
- production
deploy-dev:
stage: deploy
image: tetraweb/php:7.0
before_script:
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh deployer@YOUR_SERVERIP_HERE "cd /var/www/project/ && git fetch && git checkout dev && git pull && cp .env.example_dev .env && composer install && php artisan migrate "
environment:
name: development
only:
refs:
- dev
tags:
- live
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment