Skip to content
Permalink
Branch: master
Find file Copy path
1 contributor

Users who have contributed to this file

89 lines (79 sloc) 1.96 KB
image: lorisleiva/laravel-docker:latest
.init_ssh: &init_ssh |
eval $(ssh-agent -s)
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
mkdir -p ~/.ssh
chmod 700 ~/.ssh
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
# Replace the last line with the following lines if you'd rather
# leave StrictHostKeyChecking enabled (replace yourdomain.com):
#
# ssh-keyscan yourdomain.com >> ~/.ssh/known_hosts
# chmod 644 ~/.ssh/known_hosts
.change_file_permissions: &change_file_permissions |
find . -type f -not -path "./vendor/*" -exec chmod 664 {} \;
find . -type d -not -path "./vendor/*" -exec chmod 775 {} \;
composer:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-composer
paths:
- vendor/
script:
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
- cp .env.example .env
- php artisan key:generate
artifacts:
expire_in: 1 month
paths:
- vendor/
- .env
npm:
stage: build
cache:
key: ${CI_COMMIT_REF_SLUG}-npm
paths:
- node_modules/
script:
- npm install
- npm run production
artifacts:
expire_in: 1 month
paths:
- node_modules/
- public/css/
- public/js/
codestyle:
stage: test
dependencies: []
script:
- phpcs --standard=PSR2 --extensions=php --ignore=app/Support/helpers.php app
phpunit:
stage: test
dependencies:
- composer
script:
- phpunit --coverage-text --colors=never
staging:
stage: deploy
script:
- *init_ssh
- *change_file_permissions
- php artisan deploy dev.yourdomain.com -s upload
environment:
name: staging
url: http://dev.yourdomain.com
only:
- master
production:
stage: deploy
script:
- *init_ssh
- *change_file_permissions
- php artisan deploy yourdomain.com -s upload
environment:
name: production
url: http://yourdomain.com
when: manual
only:
- master
You can’t perform that action at this time.