From 3cae759fe15656054b2e87a6d4829319c05c6028 Mon Sep 17 00:00:00 2001 From: wangjun Date: Tue, 19 Oct 2021 18:45:42 +0800 Subject: [PATCH] test --- cicd/.drone.yml | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ cicd/Dockerfile | 2 ++ 2 files changed, 64 insertions(+) create mode 100644 cicd/.drone.yml create mode 100644 cicd/Dockerfile diff --git a/cicd/.drone.yml b/cicd/.drone.yml new file mode 100644 index 0000000..3ffc38b --- /dev/null +++ b/cicd/.drone.yml @@ -0,0 +1,62 @@ +--- +kind: pipeline +type: docker +name: wangjun/phptest + +trigger: + ref: + - refs/heads/master + - refs/heads/dev + - refs/heads/uat + - refs/tags/v* + +steps: + # 测试环境 + - name: phptest-docker + image: plugins/docker + when: + branch: + - master + settings: + dockerfile: cicd/Dockerfile + repo: registry.amtcloud.cn/wangjun/phptest + tags: + - prod-${DRONE_BUILD_NUMBER} + registry: registry.amtcloud.cn + username: + from_secret: user_registry_amtcloud + password: + from_secret: psw_registry_amtcloud + build_args: + - TARGET=master + + # 测试环境部署 + - name: phptest-deploy + image: nobugtodebug/kustomit:latest + when: + branch: + - master + commands: + - cd /app && python main.py + settings: + git_user: + from_secret: drone_gitea + git_password: + from_secret: psw_drone_gitea + project_path: ${DRONE_REPO} + target_env: prod + image_name: registry.amtcloud.cn/wangjun/phptest + image_tag: prod-${DRONE_BUILD_NUMBER} + ref_commit: ${DRONE_COMMIT} + ref_author: ${DRONE_COMMIT_AUTHOR} + +# 挂载的主机卷,可以映射到插件的容器中 +volumes: + - name: docker-cache + host: + path: /data_store/docker_root + - name: docker-sock + host: + path: /var/run/docker.sock +... + diff --git a/cicd/Dockerfile b/cicd/Dockerfile new file mode 100644 index 0000000..41f09bb --- /dev/null +++ b/cicd/Dockerfile @@ -0,0 +1,2 @@ +FROM php:7.2-apache +COPY index.php /var/www/html/ \ No newline at end of file