前端自动化发布,仅支持docker发布
npm install deploy-qy
下载依赖
``shell`
npm i deploy-qy -D 或者 yarn add deploy-qy -D
#### 按照自己的实际情况去填写 每个配置项都必填
在 根文件夹 创建一个名为 “envConfig.js” 的文件,内容为(这里只配置了一个环境,如果需要更多环境在数组中添加即可)
`shell
exports.envSetting = [
{
envName: '正式环境',
maxBuffer: 5000 * 1024,
buildCommand: 'yarn build', //打包命令
buildFileName: 'dist', //打包之后的文件夹名称 //必须填写你项目打完包后的名字 dist或build
dockerFileName: 'dockerfile', //dockerfile文件名
remoteFileRoot: '/root/deploy', //远程文件根目录 地址栏地址
dockerAddress: 'harbor.sypesco.com:5000/ry_wdl/consumer-managing-frontend:latest', //docker镜像地址
isDockerRun: false, //是否把打包成的镜像生成容器
dockerName: '', //容器名称
configServer: {
host: 'xxxxxx', //登录地址
username: 'xxxxxx', //用户名
port: 22, //端口
password: 'xxxxxx', //登录密码
privateKeyPath: '/home/steel/.ssh/id_rsa'
}
}
]
``
在根文件夹创建一个名为 “dockerfile” 的文件,为dockerfile配置文件(内容根据自己需求自定义)shell
FROM nginxinc/nginx-unprivileged FROM nginx
`
在package.json 的 script 中添加
`shell`
"deploy": "node ./node_modules/deploy-qy",
如:
`shell`
"scripts": {
"serve": "vue-cli-service serve",
"build:": "vue-cli-service build",
"deploy": "node ./node_modules/deploy-qy",
},
最后运行 npm run deploy 执行部署
`shell``
npm run deploy
———————————————————————————————————————————