重命名前端项目目录:web-flowith -> web

- 将前端项目目录从 web-flowith 重命名为 web,使目录结构更简洁
- 保持所有前端代码和配置文件不变
- 统一项目目录命名规范
This commit is contained in:
2025-07-24 22:20:19 +08:00
parent ca42a7d9a4
commit bbe8fcd776
57 changed files with 0 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
# 多阶段构建 Dockerfile for 开心APP前端
# 第一阶段:构建阶段
FROM node:18-alpine AS builder
# 设置工作目录
WORKDIR /app
# 复制package文件
COPY package*.json ./
# 安装依赖
RUN npm ci --only=production
# 复制源代码
COPY . .
# 构建应用
RUN npm run build
# 第二阶段:生产阶段
FROM nginx:alpine AS production
# 安装必要的工具
RUN apk add --no-cache curl
# 复制自定义nginx配置
COPY nginx.conf /etc/nginx/nginx.conf
# 从构建阶段复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 创建非root用户
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001
# 设置正确的权限
RUN chown -R nextjs:nodejs /usr/share/nginx/html && \
chown -R nextjs:nodejs /var/cache/nginx && \
chown -R nextjs:nodejs /var/log/nginx && \
chown -R nextjs:nodejs /etc/nginx/conf.d
# 切换到非root用户
USER nextjs
# 暴露端口
EXPOSE 80
# 健康检查
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
# 启动nginx
CMD ["nginx", "-g", "daemon off;"]