使用Dockerfile部署vue项目

项目需要部署到甲方电脑上,使用docker是个不错的选择。
1、创建Dockerfile文件

# 设置基础镜像
FROM nginx:latest# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面
COPY dist/  /usr/share/nginx/html/
# 用本地的 default.conf 配置来替换nginx镜像里的默认配置
COPY default.conf /etc/nginx/conf.d/default.conf

2、创建镜像中nginx配置文件

新建文件default.conf

# nginx配置
server {listen       80;server_name  localhost;#charset koi8-r;access_log  /var/log/nginx/host.access.log  main;error_log  /var/log/nginx/error.log  error;location / {# root 根目录,默认nginx镜像的html文件夹,可以指定其他root   /usr/share/nginx/html;index  index.html index.htm;# 如果vue-router使用的是history模式,需要设置这个 try_files $uri $uri/ /index.html;}#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;}
}

3、个人喜欢在package自定义命令:

  "scripts": {"dev": "vue-cli-service serve --open","build": "vue-cli-service build","lint": "vue-cli-service lint","docker-build": "docker build -t bim-web ."},

4、构建镜像使用命令

npm run docker-build

5、实例化容器

docker run -p 3000:80 -d --name bim-web bim-web

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/415091.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

工作183:动态渲染数据 数据在数字字典里面

1接口调用 /*调用接口*/created() {/*动态渲染content_type接口*/getAction("/dict/list",{dict_code:"content_type"}).then(res>{this.content_typeres.data})/*动态渲染*/getAction("/dict/list",{dict_code:"resource_type"})…

cesium 修改 鼠标 样式

十字: viewer._container.style.cursor "crosshair"; 默认: viewer._container.style.cursor "default";

Android 集成微信支付详解

打包后才能起调支付 微信支付成功起调 微信skd下载:https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter11_1 签名APK下载:https://open.weixin.qq.com/zh_CN/htmledition/res/dev/download/sdk/Gen_Signature_Android.apk 1、首先到微信.…

工作184:自定义事件

1子组件 mongo.vue <template><button click"eat">按钮</button> </template><script> export default {created() {this.$on("eat", function(fruit) {console.log("子组件接收自己发射的事件");});},methods:…

cesium label 显示隐藏到地底下

今天在写label的时候&#xff0c;发现高度为0时&#xff0c;label显示不全&#xff0c;影响用户体验&#xff0c;代码如下&#xff1a; window.labelEntity viewer.entities.add({label: {show: false,showBackground: true,font: "14px monospace",horizontalOrigi…

jq循环取数据 ,一直记不住,放到这

<!DOCTYPE html><html lang"en"><head> <meta charset"UTF-8"> <meta name"viewport" content"widthdevice-width, initial-scale1.0, user-scalableno"> <title>首页</title> &l…

工作185:解决vue+el-element二级联动,选项选择后不显示的问题

一、问题描述 vue的二级联动可以采用v-if的方式去实现&#xff0c;也就是在第一级选项的值发生变化后&#xff0c;清空第二级选项所关联的model的值&#xff0c;并将第二级选项所取的变量数组变更。会产生的问题是&#xff0c;第二级选项的值有时候会出现值已改变但是页面上并不…

mongodb在aggregate lookup 进行分页查询,获得记录总数

直接上代码&#xff1a; const ones await InspectTaskUser.aggregate([{$facet: {paginatedResult: [{ $match: { user_id: ObjectId(_id) } },{ $skip: (page - 1) * size },{ $limit: size },{$lookup: {from: inspecttasks,localField: task_id,foreignField: _id,as: tas…

vmware安装centos问题

* 选择安装后&#xff0c;一直黑屏 重新启动电脑&#xff0c;在启动界面进入BIOS设置&#xff0c;找到Intel (R) Virtualization Technology&#xff0c;设置成Enabled&#xff0c;保存设置以后重新启动电脑&#xff0c;问题解决。转载于:https://www.cnblogs.com/gaotaozhaole…

工作186:实际案例解决vue+el-element二级联动,选项选择后不显示的问题

1组件 <el-form-item label"所属部门" :label-width"formLabelWidth"><select-form change"DepartmentList" v-model"form.department_id" /></el-form-item><!-- <el-form-item prop"business_module&…

Render errors:One or more layouts are missing the layout_width or layout_height attributes

Render errors:One or more layouts are missing the layout_width or layout_height attributes 2017年05月25日 11:55:19 邹奇 阅读数&#xff1a;4207 标签&#xff1a; android studioxmlRendererrorsattributes 更多 个人分类&#xff1a; 安卓开发技术学习 版权声明&a…

fastapi vue socket 从其他文件调用 socket 方法

需求&#xff1a;因为项目需要&#xff0c;边做边学python&#xff0c;这次需要使用socket功能&#xff0c;正常在main.py中写个socket&#xff0c;还是OK的&#xff0c;但是我想要在其他文件中&#xff0c;直接使用socket的emit方法&#xff0c;需要在文件结构上进行一些调整。…

工作187:表单校验规则

第一种常用方式&#xff1a;表单上加rules&#xff5b;object&#xff5d; <el-form class"apply-form first-form" :model"formData" :rules"rule" ref"form"><el-form-item label"姓名" prop"visitorName&…

AndroidStudio关联svn并上传代码到svn服务器上,更换域名

SVN安装选项 到下图位置选择【command line client tools】前面的下拉框&#xff0c;选择【Will be installed on local hard drive】&#xff0c;一直下一步知道安装完成即可。 打开AndroidStudio&#xff0c;按CtrlShifS快捷键&#xff0c;进入Settings设置页面。如上图所示…

docker安装postgres

1、拉取 postgres镜像 docker pull postgres2、开启容器 docker run --name Postgres-0 -e POSTGRES_PASSWORDpassword -d -p 5432:5432 postgres:latest3、打开命令行 docker exec -it Postgres-0 bash4、切换为管理员用户 psql -U postgres5、查看用户 \du6、继续创建数…

MySQL并发复制系列一:binlog组提交 (转载)

http://blog.csdn.net/woqutechteam/article/details/51178803 MySQL Binary log在MySQL 5.1版本后推出主要用于主备复制的搭建&#xff0c;我们回顾下MySQL 在开启/关闭 Binary Log功能时是如何工作的 。 MySQL没有开启Binary log的情况下&#xff1a; InnoDB存储引擎通过re…

工作188:表单校验规则

1绑定rules <el-dialog title"新建账号" :visible.sync"dialogFormVisible" close"close"><!--1.name--><el-form ref"form" :rules"rules" :model"form" size"medium" :label-width&q…

学习knex过程中好的参考资料整理

记录本人制作博客系统和学习knex找的相关资料链接&#xff1a; 1、博客系统 https://github.com/huoguozhang/my-blog/tree/master/models 2、与typescript结合&#xff0c;TypeScript Express Objection.js Knex.js MySQL https://github.com/corocn/ts-server/tree/61c…

js-----Date==字符串

<html> <head> <meta http-equiv"Content-Type" content"text/html; charsetutf-8"> <title>js将当前时间转换为字符串日期</title> <script type"text/javascript" src"jquery-1.11.1.min.js"&…

Android Studio 项目断开SVN连接

Android Studio 断开 SVN 1.打开项目所在的文件夹&#xff0c;找到.idea文件夹 2.打开.idea文件夹&#xff0c;找到vcs.xml文件并打开 3.把vcs对应的值删掉&#xff0c;vcs“” 4.重要的来了&#xff0c;删除项目中关联svn时创建的svn隐藏文件。 在查看中设置显示隐藏的文…