kindergarten_java/reading-platform-frontend/Dockerfile
tonytech 92071e5ba6 feat(frontend): 添加 Docker 部署配置和生产环境变量
- Dockerfile:多阶段构建,node:20-alpine 编译 Vue3,
  nginx:alpine 提供静态资源服务,使用国内 npm 镜像加速
- nginx.conf:配置 Vue Router history 模式(try_files),
  /api/ 和 /uploads/ 反向代理到后端容器
- .env.production:生产环境 API 地址(8.148.151.56:3001)
- .gitignore:放开 .env.production 提交权限(无敏感信息)
2026-02-28 19:32:45 +08:00

15 lines
363 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 阶段一:编译
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install --registry=https://registry.npmmirror.com
COPY . .
RUN npx vite 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
CMD ["nginx", "-g", "daemon off;"]