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:
+15
@@ -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
|
||||
Reference in New Issue
Block a user