build(docker): add Docker build and deployment infrastructure

- Add multi-stage Dockerfile with pnpm install and Nginx serving
- Add nginx.conf with gzip and SPA fallback
- Add docker-build.sh script for building and pushing images
- Add .dockerignore for build context optimization
- Remove unused pnpm-workspace.yaml
This commit is contained in:
2026-05-25 01:32:51 +08:00
parent 94a432b14d
commit a27d205535
5 changed files with 72 additions and 3 deletions
+15
View File
@@ -0,0 +1,15 @@
# 第一阶段:构建前端
FROM node:22-alpine AS builder
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --ignore-scripts && \
pnpm rebuild esbuild
COPY . .
RUN pnpm build
# 第二阶段:Nginx 服务
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80