构建vue

This commit is contained in:
XinWei 2024-10-30 14:08:15 +08:00
parent 75cb7343dc
commit f7194d1987

View File

@ -1,45 +1,56 @@
kind: pipeline
type: docker
name: ludu-admin-vue3
kind: pipeline # 定义对象类型还有secret和signature两种类型
steps:
# - name: build
# image: node:18.18.0
# volumes:
# - name: build-file
# path: /build/dist
# commands:
# - npm install --registry=https://registry.npmmirror.com/
# - npm run build:prod
# - cp -r dist-prod/. /build/dist
type: docker # 定义流水线类型还有kubernetes、exec、ssh等类型
name: filesystem-drone # 定义流水线名称
clone:
disable: true
steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: build-copy-vue
- name: remote_transmit
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 101.43.112.107 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password # 从Secret中读取SSH密码
password:
from_secret: ssh_password
port: 22 # 远程连接端口
command_timeout: 5m # 远程执行命令超时时间
command_timeout: 20m # 远程执行命令超时时间
script:
- rm -rf ludu-admin-vue3
- git clone http://101.43.112.107:3000/root/ludu-admin-vue3.git
- cd ludu-admin-vue3
- npm install --registry=https://registry.npmmirror.com/
- npm run build:prod
- cp -r dist-prod/. /lundu-build/font
- scp -r /lundu-build/font/. root@120.46.37.243:/root/buildIndex
# volumes: # 定义流水线挂载目录,用于共享数据
# - name: build-file
# host:
# path: /mydata/buildIndex # 从宿主机中挂载的目录
- ssh root@47.118.40.3 "sh -c 'cd /build_project/ludu-admin-vue3 && git pull origin master && /usr/bin/pnpm install && /usr/bin/pnpm run build:prod && zip -r pc.zip pc'"
- scp root@47.118.40.3:/build_project/ludu-admin-vue3/pc.zip /build_package/
- scp /build_package/pc.zip root@121.36.203.133:/build_package/
- name: build-vue
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 121.36.203.133 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password2 # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 30m # 远程执行命令超时时间
script:
- echo "build-vue......"
- cd /build_package
- rm -rf pc
- unzip pc.zip
- rm -rf /nginx/html/pc
- mv pc /nginx/html/pc