diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9f7610820ce430682d4ad5f657910c5989918fb3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# 使用官方nginx镜像作为基础 +FROM nginx:latest + +# 1. 删除nginx默认欢迎页面 +RUN rm -rf /usr/share/nginx/html/* + +# 2. 【关键修改】复制 dist/* 到Nginx根目录(不包含dist文件夹本身) +COPY dist/* /usr/share/nginx/html/ + +# 3. 覆盖默认nginx配置 +# 注意:你的项目根目录需要有一个 nginx.conf 文件 +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# 4. 暴露80端口 +EXPOSE 80 + +# 5. 保持nginx前台运行(生产环境标准做法) +CMD ["nginx", "-g", "daemon off;"]