Prechádzať zdrojové kódy

Merge branch 'main' of https://git.sxidc.com/kingdee_large_screen/pc_kingdee_large_screen

liyongyong 1 rok pred
rodič
commit
1219087913
1 zmenil súbory, kde vykonal 47 pridanie a 0 odobranie
  1. 47 0
      .drone.yml

+ 47 - 0
.drone.yml

@@ -0,0 +1,47 @@
+kind: pipeline
+type: docker
+name: 自动部署
+
+clone:
+  disable: true # 禁用自带clone
+
+steps:
+  - name: 镜像打包
+    pull: if-not-exists
+    image: plugins/docker
+    settings:
+      #dockerfile: ./docker/ 默认根目录
+      repo: harbor.sxidc.com/ywzx/${DRONE_REPO_NAME//_/-}
+      registry: harbor.sxidc.com
+      tags: ${DRONE_COMMIT_BRANCH/master/latest}
+      username:
+        from_secret: harbor_username
+      password:
+        from_secret: harbor_password
+
+  - name: ssh-commands
+    pull: if-not-exists
+    image: appleboy/drone-ssh:1.5.7
+    settings:
+      host: test_host
+      username: test_user
+      password:
+        # 从drone仓库配置中秘密空间读取密码
+        from_secret: test_pwd
+      port: 22
+      script:
+        - echo =======暂停容器=======
+        - docker stop `docker ps -a | grep  kingdee_big_screen | awk '{print $1}' `
+        - echo =======暂停旧容器和镜像=======
+        - docker rm -f `docker ps -a | grep kingdee_big_screen | awk '{print $1}' `
+        - docker rmi `docker images | grep harbor.sxidc.com/fs/kingdee_big_screen | awk '{print $3}' `
+        - echo =======开始部署应用=======
+        - docker run -d -p 10003:80  --name kingdee_big_screen harbor.sxidc.com/fs/kingdee_big_screen
+        - echo =======清理构建文件,建议保留=======
+        - echo =======部署成功=======
+
+trigger:
+  branch:
+    - master
+  event:
+    - promote