完善docker部署

This commit is contained in:
2026-03-31 22:29:38 +08:00
parent 023380d14b
commit 8f0d019627
9 changed files with 410 additions and 0 deletions

29
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
# Vue 3 Frontend
FROM node:20-alpine AS builder
WORKDIR /app
# 复制依赖文件
COPY package*.json ./
# 安装依赖
RUN npm ci
# 复制源代码
COPY . .
# 构建生产版本
RUN npm run build
# ==================== Nginx 运行阶段 ====================
FROM nginx:alpine
# 复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制 Nginx 配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]