Skip to content

Instantly share code, notes, and snippets.

@itsgoingd
Created August 7, 2018 10:29
Show Gist options
  • Save itsgoingd/3bbea629f2000d26aca7f4b5096adf67 to your computer and use it in GitHub Desktop.
Save itsgoingd/3bbea629f2000d26aca7f4b5096adf67 to your computer and use it in GitHub Desktop.
GitLab CD example for a Laravel app
deploy to staging:
image: bobey/docker-gitlab-ci-runner-php7
environment:
name: staging
url: https://test.example.com
only:
- master
script:
- wget -q https://getcomposer.org/composer.phar
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_KEY")
- php composer.phar install --prefer-dist --quiet
- ./vendor/bin/dep deploy staging
deploy to production:
image: bobey/docker-gitlab-ci-runner-php7
environment:
name: production
url: https://example.com
only:
- /^release-.*$/
script:
- wget -q https://getcomposer.org/composer.phar
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_KEY")
- php composer.phar install --prefer-dist --quiet
- ./vendor/bin/dep deploy production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment