Commit de8f66f4 by zhangxingmin

push

parent 9d98389e
...@@ -20,38 +20,15 @@ RUN apt-get update && \ ...@@ -20,38 +20,15 @@ RUN apt-get update && \
# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app
# 通过构建参数接收 HBuilderX 路径
ARG HBUILDERX_PATH
ENV HBUILDERX_PATH=$HBUILDERX_PATH
ENV PATH="$HBUILDERX_PATH:${PATH}"
# 复制项目文件 # 复制项目文件
COPY . . COPY . .
# 验证 HBuilderX # 使用国内npm源安装依赖
RUN echo "### 验证 HBuilderX 安装 ###" && \
if [ -f "$HBUILDERX_PATH/cli" ]; then \
echo "HBuilderX CLI 存在" && \
chmod +x "$HBUILDERX_PATH/cli" && \
echo "版本信息: " && "$HBUILDERX_PATH/cli" --version; \
else \
echo "错误:HBuilderX CLI 不存在!" && \
echo "路径: $HBUILDERX_PATH" && \
ls -la "$HBUILDERX_PATH" || true; \
exit 1; \
fi
# 使用国内 npm 源安装依赖
RUN npm config set registry https://registry.npmmirror.com && \ RUN npm config set registry https://registry.npmmirror.com && \
npm install npm install
# 设置构建参数
ARG BUILD_PLATFORM=h5
ENV UNI_PLATFORM=$BUILD_PLATFORM
# 执行构建 # 执行构建
RUN echo "### 开始项目构建 ###" && \ RUN npm run build
cli build --project /app --platform $BUILD_PLATFORM
# =================================================== # ===================================================
# 第二阶段:运行环境 # 第二阶段:运行环境
...@@ -61,7 +38,7 @@ FROM nginx:1.25.2-alpine AS h5-runtime ...@@ -61,7 +38,7 @@ FROM nginx:1.25.2-alpine AS h5-runtime
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
# 复制构建产物 # 复制构建产物
COPY --from=builder /app/unpackage/dist/build/h5 /usr/share/nginx/html COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html
# 暴露端口 # 暴露端口
EXPOSE 8333 EXPOSE 8333
......
...@@ -16,10 +16,11 @@ ...@@ -16,10 +16,11 @@
] ]
}, },
"scripts": { "scripts": {
"build:h5": "cli build --project . --platform h5", "serve": "npm run dev:h5",
"build:android": "cli build --project . --platform android", "build": "npm run build:h5",
"build:ios": "cli build --project . --platform ios", "build:h5": "vue-cli-service uni-build --platform h5",
"start": "nginx -g 'daemon off;'" "dev:h5": "vue-cli-service uni-serve --platform h5",
"build:mp-weixin": "vue-cli-service uni-build --platform mp-weixin"
}, },
"dependencies": { "dependencies": {
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
...@@ -27,10 +28,26 @@ ...@@ -27,10 +28,26 @@
"echarts": "^5.4.1", "echarts": "^5.4.1",
"js-sha256": "^0.11.1", "js-sha256": "^0.11.1",
"nanoid": "^4.0.0", "nanoid": "^4.0.0",
"@dcloudio/uni-app": "^4.75.0", "@dcloudio/uni-app": "^3.0.0-alpha-3000020220422001",
"vue": "^3.0.0" "@dcloudio/uni-h5": "^3.0.0-alpha-3000020220422001",
"@dcloudio/uni-mp-weixin": "^3.0.0-alpha-3000020220422001",
"core-js": "^3.8.3",
"vue": "^2.6.11"
}, },
"devDependencies": { "devDependencies": {
"less": "^4.3.0" "less": "^4.3.0",
} "@dcloudio/types": "^3.0.0-alpha-3000020220422001",
"@dcloudio/vue-cli-plugin-uni": "^2.0.0-3000020220422001",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-plugin-import": "^1.13.3",
"sass": "^1.32.13",
"sass-loader": "^10.2.0",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment