1 Star 0 Fork 881

ajunlonglive/dgiot-mqtt2eventbus

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.drone.yml 3.42 KB
一键复制 编辑 原始数据 按行查看 历史
Renovate Bot 提交于 2021-10-14 20:56 . chore(deps): update node.js to v16
# 跳过构建在Commit Message中添加 [CI SKIP]
kind: pipeline
name: 打包部署[NodeJs-Npm]
clone:
disable: true
steps:
- name: 下载源代码[Git]
image: docker:git
commands:
- echo "### $DRONE_GIT_HTTP_URL -> $DRONE_BRANCH"
- git clone http://172.18.1.1:13000/lizw/dgiot_amis.git ./
- git checkout master
# - git clone $DRONE_GIT_HTTP_URL ./
# - git checkout $DRONE_BRANCH
- name: 编译源代码[Npm] docker
image: node:16.11.1-alpine3.12
volumes:
- name: package-nodejs
path: /package-nodejs
commands:
- npm config set unsafe-perm true
- npm config set cache "/package-nodejs/npm-cache"
- npm config set prefix "/package-nodejs/npm"
- npm config set registry https://registry.npm.taobao.org --global
- npm config set disturl https://npm.taobao.org/dist --global
#- npm install --prefer-offline
#- npm run build
- cd server
- npm install --prefer-offline
- cd ../
- name: 构建镜像[Docker]
image: plugins/docker
volumes:
- name: docker-daemon
path: /etc/docker
settings:
username:
from_secret: harbor_username
password:
from_secret: harbor_password
registry: '172.18.1.1:15000'
repo: '172.18.1.1:15000/node-service/dgiot_amis'
insecure: true
debug: true
dockerfile: ./Dockerfile
target: dev
tags: ['0.0.1-SNAPSHOT']
force_tag: true
auto_tag: false
auto_tag_suffix: ''
- name: 启动容器[SSH-Docker]
image: appleboy/drone-ssh
settings:
host: 172.18.1.1
port: 22
username:
from_secret: sshUsername
password:
from_secret: sshPassword
command_timeout: 300s
script:
- echo "------------------< 停止容器 >------------------"
- docker stop dgiot_amis
- echo "------------------< 删除容器 >------------------"
- docker rm -v dgiot_amis
- echo "------------------< 删除旧镜像 >------------------"
- docker rmi 172.18.1.1:15000/node-service/dgiot_amis:0.0.1-SNAPSHOT
- echo "------------------< 拉取新镜像 >------------------"
- docker pull 172.18.1.1:15000/node-service/dgiot_amis:0.0.1-SNAPSHOT
- echo "------------------< 运行新镜像 >------------------"
- docker run --name dgiot_amis -d -p 19081:9066 172.18.1.1:15000/node-service/dgiot_amis:0.0.1-SNAPSHOT
- exit
- name: 发送通知[Email]
image: drillster/drone-email
# detach: true
commands:
- date
- cd /etc
- cp /share/localtime ./
- date
- cd /bin
- ./drone-email
volumes:
- name: share
path: /share
settings:
host: smtp.qq.com
port: 465
username:
from_secret: emailUsername
password:
from_secret: emailPassword
skip_verify: false
from:
from_secret: emailUsername
recipients: [ 'lzw1000000@163.com' ]
recipients_only: false
subject: '[#{{build.number}}-{{build.status}}] {{repo.name}}'
body: 'file:///drone/src/drone-email.html'
volumes:
# 共享文件
- name: share
host:
path: /home/lizw/Desktop/docker-opt/share
# nodejs打包目录
- name: package-nodejs
host:
path: /home/lizw/Desktop/docker-opt/package/nodejs
# -------------------------------------------------------------------------------------------------------------
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ajunlonglive/dgiot-mqtt2eventbus.git
git@gitee.com:ajunlonglive/dgiot-mqtt2eventbus.git
ajunlonglive
dgiot-mqtt2eventbus
dgiot-mqtt2eventbus
master

搜索帮助