1
This commit is contained in:
@@ -1,16 +1,3 @@
|
||||
# # 使用 Nginx 官方轻量镜像
|
||||
# FROM nginx:1.25-alpine
|
||||
|
||||
# # 拷贝前端构建产物
|
||||
# COPY dist/ /usr/share/nginx/html/
|
||||
|
||||
# # 暴露端口
|
||||
# EXPOSE 80
|
||||
|
||||
# CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
|
||||
|
||||
# 第一阶段:构建阶段 - 使用指定node20.15.0版本,安装pnpm
|
||||
FROM node:20.15.0-alpine AS builder
|
||||
|
||||
@@ -46,7 +33,7 @@ FROM nginx:stable-alpine
|
||||
EXPOSE 80
|
||||
|
||||
# 可选:替换Nginx默认配置(解决前端路由刷新404、开启gzip压缩,优化静态资源)
|
||||
# COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||
# COPY ./default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# 从构建阶段(builder)复制构建后的dist目录到Nginx的静态资源根目录
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
Reference in New Issue
Block a user