首页 > 其他分享 >docker+vue+jenkins

docker+vue+jenkins

时间:2022-10-24 18:23:53浏览次数:43  
标签:npm vue log nginx html proxy jenkins docker PN

前提:

1.jenkins中git已经安装完成

2.jenkins其它配置可查看其它链接

一、目录形式

 

 二、dockerfile

 

FROM node:12.13.0 as build-stage ARG PROFILE RUN mkdir -p /app WORKDIR /app COPY package*.json ./ #RUN npm install -g cnpm --registry=https://registry.npm.taobao.org RUN npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ RUN npm install
COPY . . RUN npm run build
# production stage FROM nginx:stable-alpine as production-stage ARG PROFILE COPY nginx/nginx-${PROFILE}.conf /etc/nginx/nginx.conf COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]   三、nginx-prod.conf   user  nginx; worker_processes  1;
error_log  /var/log/nginx/error.log warn; pid        /var/run/nginx.pid;
events {     worker_connections  1024; }
http {     include       /etc/nginx/mime.types;     default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '                       '$status $body_bytes_sent "$http_referer" '                       '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;     #tcp_nopush     on;
    keepalive_timeout  65;
    #gzip  on;
    # include /etc/nginx/conf.d/*.conf;
    server {         listen       1899;         server_name  localhost; # 服务器地址或绑定域名
        #charset koi8-r;         #access_log  /var/log/nginx/host.access.log  main;
        # =========================================================         # ================== ↓↓↓↓↓↓ start ↓↓↓↓↓↓ ==================         # =========================================================
        location / {             root   /usr/share/nginx/html;             #try_files $uri $uri/ @router;             index  index.html index.htm;             try_files $uri $uri/ /index.html; # 解决页面刷新 404 问题             #proxy_pass http://zhengqingya.gitee.io; # 代理的ip地址和端口号             #proxy_connect_timeout 600; #代理的连接超时时间(单位:毫秒)             #proxy_read_timeout 600; #代理的读取资源超时时间(单位:毫秒)         }         location /api{             proxy_set_header Host $host;             proxy_set_header X-Real-IP $remote_addr;             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;             proxy_buffering off;             rewrite ^/api/(.*)$ /$1 break;             proxy_pass 你的后端地址;         }         # =========================================================         # ================== ↑↑↑↑↑↑ end ↑↑↑↑↑↑ ==================         # =========================================================
        #error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html         #         error_page   500 502 503 504  /50x.html;         location = /50x.html {             root   /usr/share/nginx/html;         }
    } } 四、jenkins流水线配置

 

 

 

#!/bin/bash -l
RE=prod; #开发环境(如dev,prod,test,stage)
PN=web;
docker rm -f $PN; #首次构建注释
docker rmi -f $PN:$RE; #首次构建注释
docker build --build-arg PROFILE=$RE -t $PN:$RE .;
docker run -d -e PROFILE=prod -p 1899:1899 --restart=always --name $PN $PN:$RE;

标签:npm,vue,log,nginx,html,proxy,jenkins,docker,PN
From: https://www.cnblogs.com/xiaokangk/p/16822343.html

相关文章

  • vue中上传、下载xlsx文件方法
    1.xlsx依赖引入npminstallxlsx--save2.downloadExcel模板下载(参数:file_Name、file_List)varXLSX=require('xlsx');//constsheetName='模板';//constfi......
  • docker部署应用
    本地centos服务器:vi/etc/sysconfig/network-scripts/ifcfg-ens33,修改和新增配置修改:BOOTPROTO=staticONBOOT=yes新增IPADDR=192.168.161.3--服务器ip地址NETMASK=255.255......
  • vue
    1前端发展介绍#HTML(5)、CSS(3)、JavaScript(ES5、ES6、ES13):编写一个个的页面->给后端(PHP、Python、Go、Java)->后端嵌入模板语法->后端渲染完数据->返回数......
  • Jenkins把GitHub项目做成Docker镜像
    欢迎访问我的GitHub这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos本篇概览本文是《Jenkins流水线(pipeline)实战》系列的第三篇,......
  • Vue+el-select v-model绑定为对象时回显失效的问题探究
    源代码如下:<template><el-selectv-model="media"value-key="mediaId"placeholder="请选择"@change="mediaChange"><el-optionv-for="iteminmedias"......
  • 记录--分享8个非常实用的Vue自定义指令
    这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助在Vue,除了核心功能默认内置的指令(v-model和v-show),Vue也允许注册自定义指令。它的作用价值在于当......
  • vue框架基础学习
    Vue的快速使用、插值语法、指令系统之文本指令、指令系统之事件指令、指令系统之属性指令......
  • 关于 Vue 中 h() 函数的一些东西
    最近在项目上需要一个信息弹窗,来显示信息。一开始只让它弹出了文字,而且只有一条信息。而给我的需求是多条文字和图片,而后我使用了elementui中的Notification通知组件来......
  • .NET 5.0 Docker 镜像 错误修复方法
    在给​​eshopondapr​​打镜像的时候碰到了3个错误1、restore:ReceivedanunexpectedEOFor0bytesfromthetransportstream:​​https://github.com/NuGet/Home/i......
  • vue中实现当前时间echarts图表时间轴动态的数据
    1<!--!废话不多说,直接看代码吧!-->2<template>3<divclass="">4<divclass="chart"ref="ref_chart"style="width:370px;height:250px;"></......