blob: deb81af274e6d024be984e3781d163915f590aa4 [file] [log] [blame]
223010146abadd72025-06-05 14:21:13 +08001# 构建阶段
2230102371ee1c92025-06-05 16:18:32 +08002FROM node:23-alpine AS builder
223010146abadd72025-06-05 14:21:13 +08003WORKDIR /src
4
5# 安装 pnpm
6RUN npm install -g pnpm
7
8# 复制依赖文件并安装
9COPY package.json pnpm-lock.yaml ./
10RUN pnpm install --frozen-lockfile
11
12# 复制源码并构建
13COPY . .
14RUN pnpm build
15
16# 生产环境
2230102371ee1c92025-06-05 16:18:32 +080017FROM nginx:1.25-alpine
18COPY --from=builder /src/dist /usr/share/nginx/html
223010146abadd72025-06-05 14:21:13 +080019COPY 50x.html /usr/share/nginx/html
20COPY nginx.conf /etc/nginx/conf.d/default.conf
21EXPOSE 80
22CMD ["nginx", "-g", "daemon off;"]