博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Docker部署Vue 工程包
阅读量:4101 次
发布时间:2019-05-25

本文共 2709 字,大约阅读时间需要 9 分钟。

docker部署 Vue 工程包

目录结构

[root@host ~]# tree front/front/├── dist.conf├── dist.zip├── Dockerfile└── nginx.conf

编写Dockerfile

这里的基础镜像是我优化过的,大家可以指定官方的

FROM nginx:1.13MAINTAINER testCOPY dist.conf /etc/nginx/conf.d/dist.confCOPY nginx.conf /etc/nginx/nginx.confRUN rm  /etc/nginx/conf.d/default.conf -rfCOPY *.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 MBStep 1 : FROM nginx:1.13 ---> d044548b1076Step 2 : MAINTAINER test ---> Running in a4f82d1f813d ---> 11891ec35400Removing intermediate container a4f82d1f813dStep 3 : COPY dist.conf /etc/nginx/conf.d/dist.conf ---> 042ebd62c9daRemoving intermediate container 8bb11197bb6eStep 4 : COPY nginx.conf /etc/nginx/nginx.conf ---> 70084e83232bRemoving intermediate container fb986e1b38cbStep 5 : RUN rm  /etc/nginx/conf.d/default.conf -rf ---> Running in 84369459ea97 ---> fa4f7acafa7bRemoving intermediate container 84369459ea97Step 6 : COPY *.zip /home/ ---> c8e3f0f60c6eRemoving intermediate container 011f626e50b3Successfully built c8e3f0f60c6e

结语

这样前端工程镜像就build好了,可以执行docker run -d -p9528:9528 dist:v0.1启动

转载地址:http://kuksi.baihongyu.com/

你可能感兴趣的文章
Linux系统编程——线程池
查看>>
yfan.qiu linux硬链接与软链接
查看>>
Linux C++线程池实例
查看>>
shared_ptr简介以及常见问题
查看>>
c++11 你需要知道这些就够了
查看>>
c++11 你需要知道这些就够了
查看>>
shared_ptr的一些尴尬
查看>>
C++总结8——shared_ptr和weak_ptr智能指针
查看>>
c++写时拷贝1
查看>>
C++ 写时拷贝 2
查看>>
Linux网络编程---I/O复用模型之poll
查看>>
Java NIO详解
查看>>
单列模式-编写类ConfigManager读取属性文件
查看>>
java中float和double的区别
查看>>
Statement与PreparedStatement区别
查看>>
Tomcat配置数据源步骤以及使用JNDI
查看>>
before start of result set 是什么错误
查看>>
(正则表达式)表单验证
查看>>
在JS中 onclick="save();return false;"return false是
查看>>
JSTL 常用标签总结
查看>>