|
@@ -0,0 +1,82 @@
|
|
|
+kind: pipeline
|
|
|
+type: docker
|
|
|
+name: kxs-mainserver-test
|
|
|
+
|
|
|
+volumes: # 声明数据卷
|
|
|
+ - name: targetDir
|
|
|
+ host:
|
|
|
+ path: /kxs_mainserver_com
|
|
|
+
|
|
|
+clone:
|
|
|
+ disable: false # 启用代码拉取
|
|
|
+
|
|
|
+steps:
|
|
|
+ - name: build-project
|
|
|
+ image: mcr.microsoft.com/dotnet/core/sdk:3.0-alpine
|
|
|
+ pull: if-not-exists
|
|
|
+ depends_on: [clone] # 依赖的步骤
|
|
|
+ volumes: # 挂载数据卷
|
|
|
+ - name: targetDir
|
|
|
+ path: /drone/src/dist/
|
|
|
+ commands: # 执行命令
|
|
|
+ - dotnet publish -c release -o ./publish
|
|
|
+ - ls ./publish
|
|
|
+ - cp -r ./publish/* /drone/src/dist # 复制文件
|
|
|
+ - ls /drone/src/dist
|
|
|
+ when:
|
|
|
+ status:
|
|
|
+ - success # 当前步骤成功时执行
|
|
|
+ - name: scp-project
|
|
|
+ image: appleboy/drone-scp
|
|
|
+ pull: if-not-exists
|
|
|
+ depends_on: [build-project] # 依赖的步骤
|
|
|
+ volumes: # 挂载数据卷
|
|
|
+ - name: targetDir # 数据卷名称
|
|
|
+ path: /kxs_mainserver_com # 容器内目录 绝对路径
|
|
|
+ settings:
|
|
|
+ host:
|
|
|
+ from_secret: host
|
|
|
+ username:
|
|
|
+ from_secret: username
|
|
|
+ password:
|
|
|
+ from_secret: userpwd
|
|
|
+ port: 22
|
|
|
+ command_timeout: 2m
|
|
|
+ target: /home/ABServer/deploy-ready/
|
|
|
+ source:
|
|
|
+ - echo ====开始拷贝=======
|
|
|
+ - /kxs_mainserver_com/*
|
|
|
+ - echo ====结束拷贝=======
|
|
|
+ when:
|
|
|
+ status:
|
|
|
+ - success # 当前步骤成功时执行
|
|
|
+
|
|
|
+ - name: deploy-project
|
|
|
+ image: appleboy/drone-ssh
|
|
|
+ pull: if-not-exists
|
|
|
+ depends_on: [scp-project] # 依赖的步骤
|
|
|
+ settings:
|
|
|
+ host:
|
|
|
+ from_secret: host
|
|
|
+ username:
|
|
|
+ from_secret: username
|
|
|
+ password:
|
|
|
+ from_secret: userpwd
|
|
|
+ port: 22
|
|
|
+ command_timeout: 2m
|
|
|
+ script:
|
|
|
+ - echo ====开始部署=======
|
|
|
+ - cd /home/ABServer/
|
|
|
+ - cp -r /home/ABServer/deploy-ready/kxs_mainserver_com /home/ABServer/webroot/
|
|
|
+ # - docker stop kxs_mainserver_com && docker rm kxs_mainserver_com && docker-compose up -d kxs_mainserver_com
|
|
|
+ - docker restart kxs_mainserver_com
|
|
|
+ - echo ====部署成功=======
|
|
|
+
|
|
|
+trigger:
|
|
|
+ branch:
|
|
|
+ include:
|
|
|
+ - test-mainserver
|
|
|
+ event:
|
|
|
+ include:
|
|
|
+ - pull_request
|
|
|
+ - push
|