Docker部署Vue 工程包
docker部署 Vue 工程包
目录结构
[root@host ~]# tree front/
front/
├── dist.conf
├── dist.zip
├── Dockerfile
└── nginx.conf
编写Dockerfile
这里的基础镜像是我优化过的,大家可以指定官方的
FROM nginx:1.13
MAINTAINER test
COPY dist.conf /etc/nginx/conf.d/dist.conf
COPY nginx.conf /etc/nginx/nginx.conf
RUN rm /etc/nginx/conf.d/default.conf -rf
COPY *.zip /home/
编写代理文件
这里的 /upload/ 是代理的图片路径
server {
listen 9528;
server_name localhost;
location / {
root /home/public;
index index.html index.htm;
}
location /upload/ {
root /home;
}
编写nginx.conf
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 2048;
}
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;
tcp_nodelay on;
types_hash_max_size 2048;
keepalive_timeout 60;
proxy_connect_timeout 3s;
proxy_read_timeout 10s;
proxy_send_timeout 10s;
server_names_hash_bucket_size 128;
client_header_buffer_size 128k;
client_max_body_size 1024m;
large_client_header_buffers 4 128k;
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 1m;
proxy_busy_buffers_size 2m;
proxy_temp_file_write_size 2m;
add_header X-Frame-Options "SAMEORIGIN";
include /etc/nginx/conf.d/*.conf;
}
build 镜像
[root@host ~]# docker build -t dist:v0.1 front/
ending build context to Docker daemon 2.75 MB
Step 1 : FROM nginx:1.13
---> d044548b1076
Step 2 : MAINTAINER test
---> Running in a4f82d1f813d
---> 11891ec35400
Removing intermediate container a4f82d1f813d
Step 3 : COPY dist.conf /etc/nginx/conf.d/dist.conf
---> 042ebd62c9da
Removing intermediate container 8bb11197bb6e
Step 4 : COPY nginx.conf /etc/nginx/nginx.conf
---> 70084e83232b
Removing intermediate container fb986e1b38cb
Step 5 : RUN rm /etc/nginx/conf.d/default.conf -rf
---> Running in 84369459ea97
---> fa4f7acafa7b
Removing intermediate container 84369459ea97
Step 6 : COPY *.zip /home/
---> c8e3f0f60c6e
Removing intermediate container 011f626e50b3
Successfully built c8e3f0f60c6e
结语
这样前端工程镜像就build好了,可以执行docker run -d -p9528:9528 dist:v0.1启动
Docker部署Vue 工程包的更多相关文章
- Docker 部署 vue 项目
Docker 部署 vue 项目 Docker 作为轻量级虚拟化技术,拥有持续集成.版本控制.可移植性.隔离性和安全性等优势.本文使用Docker来部署一个vue的前端应用,并尽可能详尽的介绍了实现思 ...
- docker部署jar工程
1.把要部署的功能打成jar 工程目录结构 pom文件 <?xml version="1.0" encoding="UTF-8"?> <pro ...
- Docker部署Vue
在服务器上创建一个存放该文件的文件夹,将生成的文件上传到这个文件夹下. 上传的同级目录中创建Dockerfile以及nginx.conf两个文件. # 设置基础镜像 FROM nginx # 定义作者 ...
- nginx部署vue工程和反向代理nodejs工程
前端是vue,后端是nodejs 前端打包成dist目录,后端接口是localhost:4000/api server { listen 80; #listen [::]:80; server_nam ...
- docker部署vue前端
1.下载安装nginx image docker pull nginx:latest 2.准备将编译后的代码上传到主机上 3.编写dockerfile, nginx conf,并创建镜像 Docker ...
- 阿里云服务器centos7,docker部署mysql+Redis+vue+springboot+Nginx+fastdfs,亲测可用
一.购买云服务器 我是今年双十一期间在阿里云购买的服务器, 简单配置2核_4G_40G_3M,三年用了不到800块,不过当时我记得腾讯云更便宜,个人感觉,阿里的云服务器更加的稳定, 毕竟身经百战, 经 ...
- Jenkins+Docker部署Maven聚合工程
这几天,把公司的预发布环境,改成docker部署,遇到了一些坑,有jenkins里的部署脚本的问题,也有harbor仓库的问题,还有docker远程访问的问题,还有DooD....一堆坑 Jenkin ...
- 使用Docker部署Spring-Boot+Vue博客系统
在今年年初的时候,完成了自己的个Fame博客系统的实现,当时也做了一篇博文Spring-boot+Vue = Fame 写blog的一次小结作为记录和介绍.从完成实现到现在,也断断续续的根据实际的使用 ...
- 详解docker部署SpringBoot及如何替换jar包
关于docker的安装和使用,可以看看之前这两篇文章.Docker从安装部署到Hello World和Docker容器的使用和连接.这篇文章主要介绍如何在docker上部署springboot项目.关 ...
随机推荐
- oracle数据库名称已被一现有约束条件占用
使用oracle数据库出现名称已被一现有约束条件占用的错误,我的原因是在同一个库中有一个表使用了外键FK_SNO,自己新建的一个表中也使用了外键FK_SNO,导致出现了错误. 这时改变一下外键FK_S ...
- MySQL事件不自动执行
前台统计数据量很大,于是在数据库中新建了一个事件,每隔10分钟执行一次存储过程,向统计表中插入统计数据 但是创建完成后发现事件并不会自动执行,上网查了一下才知道必须手工开启才事件可以 查看事件开启状态 ...
- 7za命令报错Error: xxx is not supported archive
问题: 执行7za命令时报错:Error: xxx is not supported archive 原因: 当前7za版本过低 直接执行7za可以看到当前版本: 7-Zip (A) [64] ...
- FortiGate端口聚合配置
1.端口聚合(LACP)应用场景 该功能高端设备上支持,FortiGate60D.FortiGate90D和FortiGate240D等低端型号不支持. 1.在带宽比较紧张的情况下,通过逻辑聚合可以扩 ...
- c#: 任务栏进度显示(TaskbarManager)
Win7及以上系统支持任务栏进度条,为有进度类应用显示进度于任务栏,甚为方便. 以c#之WinForm实现其,大多采用Windows API Code Pack这个方案,加多引用,比较繁琐,而我总也打 ...
- Retrofit 2.0基于OKHttp更高效更快的网络框架 以及自定义转换器
时间关系,本文就 Retrofit 2.0的简单使用 做讲解 至于原理以后有空再去分析 项目全面.简单.易懂 地址: 关于Retrofit 2.0的简单使用如下: https://gitee.c ...
- 基于ASP.NET的高校辅导员工作管理系统的设计与实现--论文随笔(四)
一.基本信息 标题:基于ASP.NET的高校辅导员工作管理系统的设计与实现 时间:2017 出版源:南通理工学院 关键词:ASP.NET; SQL Server; 高校; 管理系统; 辅导员; 二.研 ...
- goaccess
找了各种工具,最终还是觉得goaccess不仅图文并茂,而且速度快,每秒8W 的日志记录解析速度,websocket10秒刷新统计数据,站在巨人肩膀上你也会看得更远…先上图: 具体方案如下步骤: 一 ...
- 网络传输 buf 封装 示例代码
网络传输 buf 封装 示例代码 使用boost库 asio // BufferWrapTest.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h&quo ...
- Oracle异常:Caused by: java.sql.SQLException: ORA-01536: 超出表空间 '登录名' 的空间限额 (JPA保存数据)
原因: Oracle表空间为0,没有分配空间内存. 解决办法在代码框里: 1. 查看用户表空间的限额 select * from user_ts_quotas; max_bytes字段就是了 -1是代 ...