Files
sionrui/frontend/app/web-gold/Dockerfile
2025-11-10 00:59:40 +08:00

38 lines
986 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM node:20-alpine AS builder
# 使用 corepack 管理 pnpm保持与仓库锁一致
ENV PNPM_HOME=/root/.local/share/pnpm
ENV PATH=$PNPM_HOME:$PATH
RUN corepack enable
WORKDIR /workspace
# docker build -f app/web-gold/Dockerfile -t web-gold-nginx .
# docker run -d --name web-gold -p 8088:8088 web-gold-nginx
# 复制整个仓库(建议在仓库根目录作为构建上下文执行:
# docker build -f app/web-gold/Dockerfile -t web-gold-nginx .
#
COPY . .
# 安装依赖(工作区模式),严格锁定版本
RUN pnpm -w install --frozen-lockfile
# 构建前端应用(工作区内的 app/web-gold
WORKDIR /workspace/app/web-gold
RUN pnpm build
FROM nginx:alpine
# 覆盖默认站点配置(支持 Vite SPA 刷新与可选反代)
COPY app/web-gold/nginx.conf /etc/nginx/conf.d/default.conf
# 拷贝构建产物到 Nginx 根目录
COPY --from=builder /workspace/app/web-gold/dist /usr/share/nginx/html
EXPOSE 8088
CMD ["nginx", "-g", "daemon off;"]