代码拉取完成,页面将自动刷新
workspace:
base: /app
path: .
#
# khs1994.com PHP CI/CD 由 khs1994-docker/ci 提供。
#
# @link http://docs.drone.io/
# @link https://github.com/khs1994-docker/ci
#
# 项目构建设置中 Repository Hooks 全部勾选
#
pipeline:
#
# 测试 PHP 项目
#
php:
image: khs1994/php:${PHP_VERSION}-fpm-alpine
# pull: true
commands:
- pwd
- composer config -g repo.packagist composer https://packagist.laravel-china.org
- composer install -q
- composer update -q
#
# 服务初始化需要时间,这里延迟执行
#
- sleep 20
- vendor/bin/phpunit
# volumes:
# - /Users/khs1994/khs1994/khs1994-lnmp/tmp/cache:/tmp/cache
# - /data/lnmp/tmp/cache:/tmp/cache
when:
# environment: production
# platform: linux/amd64
# platform: [ linux/*, windows/amd64 ]
# status: changed
# status: [ failure, success ]
# event: tag
# event: [push, tag, deployment]
# event: [push, pull_request, tag, deployment]
event: [push, pull_request, tag]
# branch: master
# branch: prefix/*
# branch: [master, develop]
# branch:
# include: [ master, release/* ]
# exclude: [ release/1.0.0, release/1.1.* ]
#
# CI/CD 构建预上线环境 PHP NGINX 镜像
#
publish_php:
image: plugins/docker
# registry: docker.khs1994.com
repo: khs1994/php
tags: ${PHP_VERSION}-swarm-${DRONE_TAG}-alpine
target: php
mirror: https://registry.docker-cn.com
# build_args:
# - a:1
# dockerfile: Dockerfile
# dockerfile: path/to/Dockerfile
mirror: https://registry.docker-cn.com
debug: "true"
launch_debug: "true"
when:
#
# 首先在命令行设置好相关变量 DRONE_SERVER DRONE_TOKEN 右上角 Token 有详细的说明
#
# 手动在命令行执行以下命令才会执行 publish
#
# $ drone deploy khs1994-php/example 6 staging
#
event: deployment
environment: staging
secrets: [ docker_username, docker_password ]
publish_nginx:
image: plugins/docker
# registry: docker.khs1994.com
repo: khs1994/nginx
tags: ${NGINX_VERSION}-swarm-${DRONE_TAG}-alpine
target: nginx
mirror: https://registry.docker-cn.com
when:
#
# 手动在命令行执行以下命令才会执行 publish
#
# $ drone deploy khs1994-php/example 6 staging
#
#
event: deployment
environment: staging
secrets: [ docker_username, docker_password ]
#
# CI/CD 构建生产环境 PHP NGINX 镜像
#
publish_php_to_prod:
image: plugins/docker
# registry: docker.khs1994.com
repo: khs1994/php
tags: ${PHP_VERSION}-swarm-${DRONE_TAG}-alpine
target: php
mirror: https://registry.docker-cn.com
when:
#
# 手动在命令行执行以下命令才会执行 publish
#
# $ drone deploy khs1994-php/demo 6 production
#
event: deployment
environment: production
secrets: [ docker_username, docker_password ]
publish_nginx_to_prod:
image: plugins/docker
# registry: docker.khs1994.com
repo: khs1994/nginx
tags: ${NGINX_VERSION}-swarm-${DRONE_TAG}-alpine
target: nginx
mirror: https://registry.docker-cn.com
when:
#
# 手动在命令行执行以下命令才会执行 publish
#
# $ drone deploy khs1994-php/demo 6 production
#
#
event: deployment
environment: production
secrets: [ docker_username, docker_password ]
services:
mysql:
image: mysql:${MYSQL_VERSION}
environment:
- MYSQL_DATABASE=test
- MYSQL_ROOT_PASSWORD=mytest
# entrypoint: [ "mysqld" ]
command: [ "--character-set-server=utf8mb4", "--default-authentication-plugin=mysql_native_password" ]
# postgresql:
# image: postgres:${POSTGRESQL_VERSION}
# environment:
# - POSTGRES_USER=postgres
# - POSTGRES_DB=test
redis:
image: redis:${REDIS_VERSION}
# mongodb:
# image: mongo:${MONGODB_VERSION}
# command: [ --smallfiles ]
matrix:
PHP_VERSION:
- 7.2.9
- 7.1.21
# - 7.0.30
# - 5.6.36
NGINX_VERSION:
- 1.15.3
REDIS_VERSION:
- 5.0-rc4-alpine
MYSQL_VERSION:
# - 8.0.11
- 5.7.22
MONGODB_VERSION:
- 3.7.3
POSTGRESQL_VERSION:
- 10.3-alpine
# branches:
# include: [ master, dev, feature/* ]
# exclude: [ release/1.0.0, release/1.1.* ]
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。