🎨 更新环境配置,添加 Dockerfile,优化代码结构

This commit is contained in:
2026-04-21 22:09:19 +08:00
parent 81d8466f88
commit 5c2a146a44
35 changed files with 6396 additions and 141 deletions

26
web-admin/Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
# ---- deps ----
FROM node:20-alpine AS deps
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# ---- build ----
FROM node:20-alpine AS builder
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG VITE_BASE_API=/api
ENV VITE_BASE_API=$VITE_BASE_API
RUN pnpm exec vite build
# ---- runtime ----
FROM nginx:alpine AS runner
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]