Laravel 在共享主机上使用 bitbucket 管道的项目
Laravel project with bitbucket pipeline on shared hosting
我目前正在 Bitbucket 中为我的 Laravel 项目设置一个管道(仅供参考,我是 CD/CI 的新手),它应该会自动部署我最新构建的 master 分支到我的网站。因为服务器没有安装 composer 我无法安装依赖项或部署我的项目需要的迁移。
是否可以使用管道构建整个项目并使用 git-ftp
之类的方法将其完全移动到服务器上?在我的 bitbucket-pipelines.yml
文件下面。
image: php:7.2-fpm
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip gnupg ssh
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
- npm install
- npm run production
- php -r "file_exists('.env') || copy('.env.pipelines', '.env');"
- composer dump-autoload
- php artisan key:generate
- php artisan migrate
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD $FTP_HOST_PATH_P
我目前的解决方案如下
我已经跳过了管道的使用,并从我的 .gitignore
文件中删除了对 ./vendor
文件夹的排除。我创建了一个支持 git 的子域,允许我拉取和部署我的开发分支。为我的 production/master 分支做了同样的事情。
我目前正在 Bitbucket 中为我的 Laravel 项目设置一个管道(仅供参考,我是 CD/CI 的新手),它应该会自动部署我最新构建的 master 分支到我的网站。因为服务器没有安装 composer 我无法安装依赖项或部署我的项目需要的迁移。
是否可以使用管道构建整个项目并使用 git-ftp
之类的方法将其完全移动到服务器上?在我的 bitbucket-pipelines.yml
文件下面。
image: php:7.2-fpm
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip gnupg ssh
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- curl -sL https://deb.nodesource.com/setup_8.x | bash -
- apt-get install -y nodejs
- npm install
- npm run production
- php -r "file_exists('.env') || copy('.env.pipelines', '.env');"
- composer dump-autoload
- php artisan key:generate
- php artisan migrate
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD $FTP_HOST_PATH_P
我目前的解决方案如下
我已经跳过了管道的使用,并从我的 .gitignore
文件中删除了对 ./vendor
文件夹的排除。我创建了一个支持 git 的子域,允许我拉取和部署我的开发分支。为我的 production/master 分支做了同样的事情。