Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 {} \;
- build:
- stage: build
- cache:
- key: ${CI_COMMIT_REF_SLUG}
- paths:
- - node_modules/
- - vendor/
- services:
- - mariadb:latest
- variables:
- MYSQL_DATABASE: "test"
- MYSQL_ROOT_PASSWORD: "secret"
- MYSQL_ROOT_HOST: "%"
- script:
- - composer install --no-interaction --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs
- - cp .env.testing .env
- - php artisan key:generate
- - php artisan config:cache
- #- php artisan route:cache
- - npm install
- - npm run prod
- - php artisan migrate --seed
- - php artisan storage:link
- - php artisan serve &
- - vendor/bin/phpunit
- artifacts:
- expire_in: 1 month
- paths:
- - vendor/
- - node_modules/
- - public/css/
- - public/js/
- codestyle:
- stage: test
- dependencies:
- - build
- script:
- - phpcs --standard=PSR2 --extensions=php --ignore=app/Support/helpers.php app
- #phpunit:
- # stage: test
- # dependencies:
- # - build
- # script:
- # - php artisan key:generate
- # - php artisan serve &
- # - vendor/bin/phpunit
- staging:
- stage: deploy
- script:
- - *init_ssh
- - *change_file_permissions
- # copy .env.development to .env
- - cp .env.staging .env
- - php artisan key:generate
- - php artisan config:clear
- - php artisan config:cache
- - php artisan deploy dev.mydomain.ch -s upload
- environment:
- name: staging
- url: http://dev.mydomain.ch
- only:
- - master
- production:
- stage: deploy
- script:
- - *init_ssh
- - *change_file_permissions
- # copy .env.production to .env
- - cp .env.production .env
- - php artisan key:generate
- - php artisan config:cache
- - php artisan deploy mydomain.ch -s upload
- environment:
- name: production
- url: http://mydomain.ch
- when: manual
- only:
- - master
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement