npm run build 打包vue项目
启动 docker
将dist目录通过winscp等方式拷贝到linux服务器上,同目录下新建Dockerfile
Dockerfile:
FROM nginx:latest (latest是下载最新的nginx,也可以指定nginx版本)
MAINTAINER xxx (xxx 为名字)
COPY dist/ /home/myhtml/front/ (当前目录的dist文件夹复制到容器的/home/myhtml/front/文件夹)
COPY nginx.conf /etc/nginx/nginx.conf (当前目录的nginx.conf复制到容器的nginx配置中)
RUN echo 'echo init ok!!'
nginx.conf:
worker_processes auto;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer"