代码拉取完成,页面将自动刷新
stages:
- pull_code_test
- pull_code_production
- install_deps
- test
- build
- deploy_test
- deploy_production
variables:
PHP_FPM_CONTAINER: lnmp-php-fpm
WORK_DIR: /usr/share/nginx/html/
PROJECT: laravel-demo
GIT_DIR: /mnt/lnmp-docker
# 拉取代码
pull_code_test:
stage: pull_code_test
only:
- develop
script:
- cd ${GIT_DIR}/${PROJECT}
- git pull origin develop
pull_code_production:
stage: pull_code_production
only:
- master
script:
- cd ${GIT_DIR}/${PROJECT}
- git pull origin master
# 安装依赖
install_deps:
stage: install_deps
script:
- docker exec -w ${WORK_DIR}/${PROJECT} ${PHP_FPM_CONTAINER} composer install
build:
stage: build
script:
# Run migrations
- docker exec -w ${WORK_DIR}/${PROJECT} ${PHP_FPM_CONTAINER} php artisan migrate
# Cache clearing
- docker exec -w ${WORK_DIR}/${PROJECT} ${PHP_FPM_CONTAINER} php artisan cache:clear
# Create a cache file for faster configuration loading
- docker exec -w ${WORK_DIR}/${PROJECT} ${PHP_FPM_CONTAINER} php artisan config:cache
# Create a route cache file for faster route registration
- docker exec -w ${WORK_DIR}/${PROJECT} ${PHP_FPM_CONTAINER} php artisan route:clear
deploy_test:
stage: deploy_test
script:
- cd ${GIT_DIR}
- docker-compose down && docker-compose build && docker-compose up -d
deploy_production:
stage: deploy_production
script:
- cd ${GIT_DIR}
- docker-compose restart
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。