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项目.关 ...
随机推荐
- 动态创建js脚本和 css样式
//1.动态添加外部js文件 function loadScript(url){ var script = document.createElement("script"); sc ...
- FOB cost---从工厂到码头的费用
1.主要是港杂费:陆运400元起,2个方450元,三个方500元,3个方以上按100元/方算起.
- 二叉搜索树与双向链表(python)
题目描述 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不能创建任何新的结点,只能调整树中结点指针的指向. # -*- coding:utf-8 -*- # class TreeNo ...
- ROLAP、MOLAP和HOLAP区别
对没有使用过数据仓库的人,对这三个概念确实是有点混淆不清.包括我自己本身不是做数据仓库出身,所以实际上是从实践出发,理论基础是有点匮乏的. 一.基本概念 1. OLAP OLAP(on-Line An ...
- stark组件开发之排序
class StartHandler(object): .......... ordered_list = [] # 排序规则由 用户指定. def get_ordered_list(self): r ...
- Linux驱动之中断处理体系结构简析
S3C2440中的中断处理最终是通过IRQ实现的,在Linux驱动之异常处理体系结构简析已经介绍了IRQ异常的处理过程,最终分析到了一个C函数asm_do_IRQ,接下来继续分析asm_do_IRQ, ...
- MySQL开发——【介绍、安装】
什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库, 每个数据库都有一个或多个不同的API用于创建,访问,管理,搜索和复制所保存的数据. 数据库的分类? 关系型数据库 ...
- jquery 表单校验
<link type="text/css" href="<%=basepath%>css/form/validate.css" rel=&qu ...
- C++ 提取网页内容系列之三
标 题: C++ 提取网页内容系列作 者: itdef链 接: http://www.cnblogs.com/itdef/p/4171659.html 欢迎转帖 请保持文本完整并注明出处 这次继续下载 ...
- delphi 中record 的类操作符重载简介
今天简单介绍一下 delphi 中record 的类操作符重载使用,就是如何 实现 record 之间的简单操作. 关于类操作符重载 ,大家可以看官方的文档. Delphi allows certai ...