vue在Docker上运行

Dockerfile
# 设置基础镜像 
FROM nginx:latest
# 定义作者
MAINTAINER test
# 将dist文件中的内容复制到 /etc/nginx/html/ 这个目录下面
COPY dist/  /etc/nginx/html/
# 将配置文件中的内容复制到 /etc/nginx 这个目录下面(增加自己的代理及一些配置)
RUN rm -rf /etc/nginx/nginx.conf 
COPY nginx.conf /etc/nginx/nginx.conf

  

nginx.conf
user  nginx;
worker_processes  auto;
 
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
 
 
events {
    worker_connections  1024;
}
 
 
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;
 
    keepalive_timeout  65;
 
    #gzip  on;
 
	server {
		listen       80;
		listen  [::]:80;
		server_name  localhost;
		location / {
			root   /etc/nginx/html;
			index  index.html index.htm;
		}
		location = /50x.html {
			root   /usr/share/nginx/html;
		}
		
	}
}

  

全自动发布:

 

posted @ 2021-06-21 10:39  畅聊科技  阅读(123)  评论(0编辑  收藏  举报