修改vue docker 配置文件

This commit is contained in:
BBIT-Kai
2025-05-12 11:30:27 +08:00
parent 369980293e
commit cdaa958e75
5 changed files with 14 additions and 12 deletions
+7 -5
View File
@@ -1,4 +1,4 @@
FROM node:22-slim AS builder
FROM node:slim AS builder
# --max-old-space-size
ENV PNPM_HOME="/pnpm"
@@ -15,23 +15,25 @@ COPY . /app
# 安装依赖
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build --filter=\!./docs
# RUN pnpm run build --filter=\!./docs
RUN pnpm run build --filter=@vben/web-antd
RUN echo "Builder Success 🎉"
FROM nginx:stable-alpine AS production
FROM nginx:1.27.4-alpine AS production
# 配置 nginx
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf \
&& rm -rf /etc/nginx/conf.d/default.conf
# 复制构建产物
COPY --from=builder /app/playground/dist /usr/share/nginx/html
COPY --from=builder /app/apps/web-antd/dist /usr/share/nginx/html
# 复制 nginx 配置
COPY --from=builder /app/scripts/deploy/nginx.conf /etc/nginx/nginx.conf
EXPOSE 8080
EXPOSE 8090
# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]