1.1.5 • Published 6 months ago

deploy-qy v1.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

下载依赖

npm i deploy-qy -D   或者  yarn add deploy-qy -D

按照自己的实际情况去填写 每个配置项都必填

在 根文件夹 创建一个名为 “envConfig.js” 的文件,内容为(这里只配置了一个环境,如果需要更多环境在数组中添加即可)

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配置文件(内容根据自己需求自定义)

FROM nginxinc/nginx-unprivileged 
# FROM nginx

# 用echo添加多行内容
RUN cd /etc/nginx/conf.d/ && http_origin='$http_origin' && echo 'server {\n\
    listen       8080;\n\
    listen  [::]:8080;\n\
    server_name  localhost;\n\
    location / {\n\
        root   /usr/share/nginx/html;\n\
        add_header Access-Control-Allow-Methods *;\n\
        add_header Access-Control-Allow-Origin $http_origin;\n\
        index  index.html index.htm;\n\
  	try_files $uri $uri/ /index.html; \n\
    }\n\
    error_page   500 502 503 504  /50x.html;\n\
    location = /50x.html {\n\
        root   /usr/share/nginx/html;\n\
    }\n\
}\n'\
> default.conf
COPY dist/ /usr/share/nginx/html/

在package.json 的 script 中添加

"deploy": "node ./node_modules/deploy-qy",

如:

  "scripts": {
    "serve": "vue-cli-service serve",
    "build:": "vue-cli-service build",
    "deploy": "node ./node_modules/deploy-qy",
  },

最后运行 npm run deploy 执行部署

npm run deploy

———————————————————————————————————————————

1.1.5

6 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.3

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago