Files
msksbr a27d205535 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
2026-05-25 01:32:51 +08:00

16 lines
394 B
Docker

# 第一阶段:构建前端
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