From 5cd03e1b3e37f869eb1098c5ba78f2dd38e90b2e Mon Sep 17 00:00:00 2001 From: BrunoGao Date: Sat, 30 Aug 2025 07:52:00 +0800 Subject: [PATCH] transfering --- build-and-push.sh | 36 +- ljwx-admin/Dockerfile.prod | 61 +- ljwx-bigscreen/bigscreen/Dockerfile.prod | 34 +- .../bigScreen/templates/personal.html | 813 ++++++++++++++---- ljwx-boot/ljwx-boot-admin/Dockerfile.prod | 54 +- ljwx-phone/ENTERPRISE_UI_GUIDE.md | 237 +++++ ljwx-phone/lib/global.dart | 4 + ljwx-phone/lib/screens/alert_screen.dart | 172 +++- .../lib/screens/health_analysis_screen.dart | 44 +- ljwx-phone/lib/services/api_service.dart | 49 ++ ljwx-phone/lib/theme/app_theme.dart | 311 +------ ljwx-phone/pubspec.lock | 292 ++++--- ljwx-phone/pubspec.yaml | 2 +- 13 files changed, 1371 insertions(+), 738 deletions(-) create mode 100644 ljwx-phone/ENTERPRISE_UI_GUIDE.md diff --git a/build-and-push.sh b/build-and-push.sh index a740957..40338a6 100755 --- a/build-and-push.sh +++ b/build-and-push.sh @@ -156,6 +156,15 @@ build_app_image() { fi ;; "boot") + # 预构建 JAR 包 + echo "🔨 预构建 Spring Boot JAR 包..." + if [ ! -f "ljwx-boot/ljwx-boot-admin/target/*.jar" ]; then + echo "⚠️ 未找到预构建的JAR文件,需要先构建Java项目" + echo "💡 请运行: cd ljwx-boot && mvn clean package -DskipTests" + exit 1 + else + echo "✅ 找到预构建的JAR文件" + fi if [ "$LOCAL_BUILD" = "true" ] && [ "$PLATFORMS" = "linux/amd64" ]; then docker build -t $tag -t $latest_tag . -f ljwx-boot/ljwx-boot-admin/Dockerfile.prod else @@ -163,13 +172,36 @@ build_app_image() { fi ;; "bigscreen") + # 更新了使用Python 3.12 if [ "$LOCAL_BUILD" = "true" ] && [ "$PLATFORMS" = "linux/amd64" ]; then - docker build -t $tag -t $latest_tag ljwx-bigscreen/bigscreen/ -f ljwx-bigscreen/bigscreen/Dockerfile.multiarch + docker build -t $tag -t $latest_tag ljwx-bigscreen/bigscreen/ -f ljwx-bigscreen/bigscreen/Dockerfile.prod else - docker $build_args -t $tag -t $latest_tag ljwx-bigscreen/bigscreen/ -f ljwx-bigscreen/bigscreen/Dockerfile.multiarch + docker $build_args -t $tag -t $latest_tag ljwx-bigscreen/bigscreen/ -f ljwx-bigscreen/bigscreen/Dockerfile.prod fi ;; "admin") + # 预构建前端资源 + echo "🔨 预构建前端资源..." + if [ ! -d "ljwx-admin/dist" ]; then + echo "⚠️ 未找到预构建的dist目录,正在执行前端构建..." + cd ljwx-admin + if command -v pnpm >/dev/null 2>&1; then + echo "使用 pnpm 构建..." + pnpm install --frozen-lockfile + pnpm run build + elif command -v npm >/dev/null 2>&1; then + echo "使用 npm 构建..." + npm install + npm run build + else + echo "❌ 未找到 pnpm 或 npm,请安装 Node.js 和包管理器" + exit 1 + fi + cd .. + echo "✅ 前端构建完成" + else + echo "✅ 找到预构建的dist目录" + fi if [ "$LOCAL_BUILD" = "true" ] && [ "$PLATFORMS" = "linux/amd64" ]; then docker build -t $tag -t $latest_tag ljwx-admin/ -f ljwx-admin/Dockerfile.prod else diff --git a/ljwx-admin/Dockerfile.prod b/ljwx-admin/Dockerfile.prod index f5ebe0d..c2f8ecd 100644 --- a/ljwx-admin/Dockerfile.prod +++ b/ljwx-admin/Dockerfile.prod @@ -1,56 +1,4 @@ -# 多阶段构建,减小镜像体积 -FROM node:18-alpine AS builder - -# 设置北京时区 -ENV TZ=Asia/Shanghai -RUN apk add --no-cache tzdata && \ - ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ - echo $TZ > /etc/timezone - -RUN corepack enable && corepack prepare pnpm@10.8.0 --activate -WORKDIR /app -COPY package.json pnpm-lock.yaml .npmrc pnpm-workspace.yaml ./ -COPY packages/ ./packages/ -RUN pnpm install --frozen-lockfile -COPY src/ ./src/ -COPY public/ ./public/ -COPY build/ ./build/ -COPY index.html ./ -COPY vite.config.ts ./ -COPY tsconfig.json ./ -COPY uno.config.ts ./ -ENV VITE_BASE_URL=./ -ARG VITE_APP_TITLE=穿戴健康管理平台 -ARG VITE_APP_DESC=穿戴健康管理平台 -ENV VITE_APP_TITLE=${VITE_APP_TITLE} -ENV VITE_APP_DESC=${VITE_APP_DESC} -ENV VITE_ICON_PREFIX=icon -ENV VITE_ICON_LOCAL_PREFIX=icon-local -ENV VITE_AUTH_ROUTE_MODE=dynamic -ENV VITE_ROUTE_HOME=home -ENV VITE_MENU_ICON=mdi:menu -ENV VITE_HTTP_PROXY=Y -ENV VITE_ROUTER_HISTORY_MODE=hash -ENV VITE_SERVICE_SUCCESS_CODE=200 -ENV VITE_SERVICE_LOGOUT_CODES=600,401 -ENV VITE_SERVICE_MODAL_LOGOUT_CODES=401 -ENV VITE_SERVICE_EXPIRED_TOKEN_CODES=40101 -ENV VITE_STATIC_SUPER_ROLE=R_SUPER -ENV VITE_AUTH_BUTTON_MODE=route_meta -ENV VITE_SOURCE_MAP=N -ENV VITE_STORAGE_PREFIX=SOY_ -ENV VITE_AUTOMATICALLY_DETECT_UPDATE=Y -ENV VITE_HTTP_PROXY=Y -ENV VITE_API_URL=/proxy-default -ENV VITE_SERVICE_BASE_URL=/proxy-default -ENV VITE_OTHER_SERVICE_BASE_URL='{"bigscreen": "/bigscreen/"}' -ARG VITE_BIGSCREEN_URL=http://localhost:8001 -ARG VITE_CUSTOM_LOGO=false -ENV VITE_BIGSCREEN_URL=${VITE_BIGSCREEN_URL} -ENV VITE_CUSTOM_LOGO=${VITE_CUSTOM_LOGO} -RUN pnpm run build - -# 生产环境nginx镜像 +# 使用预构建的 dist 目录 FROM nginx:alpine # 设置北京时区 @@ -60,9 +8,10 @@ RUN apk add --no-cache tzdata && \ echo $TZ > /etc/timezone RUN apk add --no-cache findutils # 添加find命令支持 -COPY --from=builder /app/dist /usr/share/nginx/html -COPY nginx/nginx.conf /etc/nginx/nginx.conf -COPY docker-entrypoint.sh /docker-entrypoint.sh +# 直接复制预构建的 dist 目录 +COPY ljwx-admin/dist /usr/share/nginx/html +COPY ljwx-admin/nginx/nginx.conf /etc/nginx/nginx.conf +COPY ljwx-admin/docker-entrypoint.sh /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh EXPOSE 80 ENTRYPOINT ["/docker-entrypoint.sh"] diff --git a/ljwx-bigscreen/bigscreen/Dockerfile.prod b/ljwx-bigscreen/bigscreen/Dockerfile.prod index c167133..ba9810d 100644 --- a/ljwx-bigscreen/bigscreen/Dockerfile.prod +++ b/ljwx-bigscreen/bigscreen/Dockerfile.prod @@ -1,26 +1,34 @@ -# 构建阶段 - 使用标准Python镜像以提高兼容性 -FROM python:3.9-slim AS builder +# 构建阶段 - 使用标准Python 3.12镜像以提高兼容性 +FROM python:3.12-slim AS builder WORKDIR /app -# 安装构建依赖 -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc g++ pkg-config libmariadb-dev && \ - pip install --no-cache-dir --upgrade pip +# 使用阿里云镜像源加速,禁用代理 +RUN unset http_proxy https_proxy && \ + echo "deb https://mirrors.aliyun.com/debian bookworm main" > /etc/apt/sources.list && \ + echo "deb https://mirrors.aliyun.com/debian-security bookworm-security main" >> /etc/apt/sources.list && \ + echo "deb https://mirrors.aliyun.com/debian bookworm-updates main" >> /etc/apt/sources.list && \ + apt-get update --fix-missing && \ + apt-get install -y --no-install-recommends gcc g++ pkg-config default-libmysqlclient-dev && \ + pip install --no-cache-dir --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ COPY requirements-docker.txt . -RUN pip install --no-cache-dir --user -r requirements-docker.txt +RUN pip install --no-cache-dir --user -r requirements-docker.txt -i https://mirrors.aliyun.com/pypi/simple/ -# 运行阶段 - 使用slim镜像 -FROM python:3.9-slim +# 运行阶段 - 使用Python 3.12 slim镜像 +FROM python:3.12-slim WORKDIR /app -# 只安装运行时必需的库 -RUN apt-get update && apt-get install -y --no-install-recommends \ - libmariadb3 tzdata && \ +# 使用阿里云镜像源加速,禁用代理 +RUN unset http_proxy https_proxy && \ + echo "deb https://mirrors.aliyun.com/debian bookworm main" > /etc/apt/sources.list && \ + echo "deb https://mirrors.aliyun.com/debian-security bookworm-security main" >> /etc/apt/sources.list && \ + echo "deb https://mirrors.aliyun.com/debian bookworm-updates main" >> /etc/apt/sources.list && \ + apt-get update --fix-missing && \ + apt-get install -y --no-install-recommends default-mysql-client tzdata && \ ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ apt-get clean && rm -rf /var/lib/apt/lists/* # 从构建阶段复制Python包 COPY --from=builder /root/.local /root/.local # 确保Python包在PATH中 ENV PATH=/root/.local/bin:$PATH -ENV PYTHONPATH=/root/.local/lib/python3.9/site-packages:$PYTHONPATH +ENV PYTHONPATH=/root/.local/lib/python3.12/site-packages:$PYTHONPATH # 复制应用文件 COPY . . # 清理Python缓存和不需要的文件 diff --git a/ljwx-bigscreen/bigscreen/bigScreen/templates/personal.html b/ljwx-bigscreen/bigscreen/bigScreen/templates/personal.html index 8ee9695..1a2ce8d 100644 --- a/ljwx-bigscreen/bigscreen/bigScreen/templates/personal.html +++ b/ljwx-bigscreen/bigscreen/bigScreen/templates/personal.html @@ -10,6 +10,7 @@ +