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

Som*_*Dev 3 laravel gitlab gitlab-ci gitlab-ci-runner

现在我有兴趣使用 gitlab ci cd 在我的自定义 VPS 上部署我的 Laravel 应用程序,我想在没有 docker 的情况下进行。但是我找到的每个教程都在使用 docker。我正在寻找 .gitlab.ci.yml 的样本,以涵盖我的情况。PS我已经为laravel配置了我的vps。

Som*_*Dev 6

最后,经过对 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"
Run Code Online (Sandbox Code Playgroud)

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