1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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
|