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项目.关 ...
随机推荐
- Windows 10 系统,配置jdk系统环境变量
1. 下载jdk包,下载路径为:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, ...
- Django的rest_framework认证组件之局部设置源码解析
前言: Django的rest_framework组件的功能很强大,今天来我来给大家剖析一下认证组件 下面进入正文分析,我们从视图开始,一步一步来剖析认证组件 1.进入urls文件 url(r'^lo ...
- 560. Subarray Sum Equals K 求和为k的子数组个数
[抄题]: Given an array of integers and an integer k, you need to find the total number of continuous s ...
- thinkphp用ajax遇到的坑——ajax请求没有反应
view视图的 html 的 js 代码如下, $.ajax({ url:"test",//这里指向的就不再是页面了,而是一个方法. ...
- 用php获取js变量的值
<script type="text/javascript"> var t1 = "fff"; var t2 = "<?php ec ...
- cnetos 下 rar 解压
第一步:http://www.rarlab.com/rar/rarlinux-x64-5.3.0.tar.gz 下载 文件 或 wget http://www.rarlab.com/rar/rarli ...
- yum提示Another app is currently holding the yum lock
使用yum grouplis列举系统中以组安装的包,结果提示: # yum grouplist Loaded plugins: fastestmirror, refresh-packagekit, s ...
- c++模板笔记
使用vc2015进行C++ 模板的学习实验和笔记 用简单示例学习了解STL template大部头理论书 讲解各种规则和各种规则例外的解决办法 集中精力在20%的规则中的阴暗角落而不是80%实践中要注 ...
- 创建 sp
创建 sharepoint solutions---Empty project--module(跟环境中的网站页面一样) element.xml增加pages url=“site pages” 将ws ...
- javaScrpit 开端
JavaScript 代码可以直接嵌在网页的任何地方,不过我们通常把JavaScrpit放到<head>中: <html> <head> <script> ...