Files
website/Dockerfile.noproxy
brunoandQwen-Coder 39ae577965 Feature: Add AI Assistant, Enhanced Search, and Responsive Design Improvements
- Add AIAssistant component for intelligent user support
- Implement EnhancedSearchModal with improved search functionality
- Introduce LazyImage component for optimized image loading
- Update HeroSection with responsive design classes
- Modify Navigation to support dynamic base paths for production
- Update Dockerfile with optimized multi-stage build and health checks
- Configure docker-compose.yml with proper port mapping
- Add comprehensive responsive CSS classes in index.css
- Update routing configuration in App.tsx and main.tsx
- Add development documentation in CLAUDE.md and QWEN.md
- Configure build process with environment-specific base paths
- Add optimization roadmap documentation

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2025-11-17 15:50:09 +08:00

75 lines
2.0 KiB
Docker

# 无代理优化 Dockerfile - 使用国内镜像源和缓存
# 专门解决无代理环境下的构建问题
# 构建阶段
FROM node:18-alpine as builder
WORKDIR /app
# 使用国内镜像源加速 apk 包管理
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 配置 npm 使用国内镜像源
RUN npm config set registry https://registry.npmmirror.com
# 配置 npm 缓存
RUN npm config set cache /tmp/.npm --global
# 安装 pnpm (使用国内镜像源)
RUN npm install -g pnpm --registry=https://registry.npmmirror.com
# 复制 package 文件
COPY package.json pnpm-lock.yaml ./
# 配置 pnpm 使用国内镜像源
RUN pnpm config set registry https://registry.npmmirror.com
# 安装依赖 (带重试机制)
RUN pnpm install --frozen-lockfile || \
(pnpm install --frozen-lockfile) || \
(pnpm install --frozen-lockfile)
# 复制源代码
COPY . .
# 构建应用 (带重试机制)
RUN npm run build || \
(sleep 10 && npm run build) || \
(sleep 30 && npm run build)
# 生产阶段
FROM node:18-alpine
WORKDIR /app
# 使用国内镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 配置 npm 使用国内镜像源
RUN npm config set registry https://registry.npmmirror.com
# 安装 pnpm 和 serve
RUN npm install -g pnpm serve --registry=https://registry.npmmirror.com
# 复制构建产物
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./
COPY --from=builder /app/pnpm-lock.yaml ./
# 安装生产依赖 (带重试机制)
RUN pnpm install --prod --frozen-lockfile || \
(sleep 10 && pnpm install --prod --frozen-lockfile)
# 清理缓存减少镜像大小
RUN npm cache clean --force && \
pnpm store prune
# 暴露端口
EXPOSE 5173
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:5173 || exit 1
# 启动应用
CMD ["serve", "-s", "dist", "-l", "5173"]