在没有DOCKER的VPS中使用gitlab ci部署laravel



现在我有兴趣使用gitlab ci cd在我的自定义VPS上部署我的laravel应用程序,我想在没有docker的情况下完成它。但我发现的每一个教程都在使用docker。我正在寻找一个.gitlab.ci.yml的样本,它将涵盖我的情况。附言:我已经为laravel配置了vps。

经过对gitlab本身的一些研究和试验,我终于明白了。我使用了gitlab runner来执行.gitlab-ci.yml中的作业,并在一开始就写了这个yml文件:

before_script:
- echo "Before script"
- cd /var/www/html/project
building:
stage: build
script:
- git pull origin develop
- composer install
- cp .env.example .env
- php artisan key:generate
- php artisan migrate --seed
- sudo chown -R my-user:www-data /var/www/html/project/
- find /var/www/html/project -type f -exec chmod 664 {} ;
- find /var/www/html/project -type d -exec chmod 775 {} ;
- chgrp -R www-data storage bootstrap/cache
- chmod -R ug+rwx storage bootstrap/cache
testing:
stage: test
script:
- php ./vendor/bin/phpunit
deploying:
stage: deploy
script:
- echo "Deployed"

如果你有更好的解决方案,你可以在这里写。

最新更新