Commit 53c634fa by zhangxingmin

push

parent c11868a0
FROM node:14-alpine AS builder FROM node:14-alpine AS builder
# 设置工作目录
WORKDIR /app WORKDIR /app
# 替换Alpine源为国内镜像 + 安装系统依赖 # 系统依赖和镜像源配置
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk add --no-cache python3 make g++ && apk add --no-cache python3 make g++
# 复制包文件并设置npm镜像源 # 复制并安装依赖
COPY package*.json ./ COPY package*.json ./
RUN npm config set registry https://registry.npmmirror.com \ RUN npm config set registry https://registry.npmmirror.com \
&& npm config set disturl https://npmmirror.com/dist \ && npm install -g @dcloudio/uni-cli-service@2.0.0-27920200624001 --registry=https://registry.npmjs.org \
&& npm config set sass_binary_site https://npmmirror.com/mirrors/node-sass/ \ && npm install @dcloudio/vue-cli-plugin-uni@2.0.0-27920200624001 --registry=https://registry.npmjs.org \
&& npm cache clean --force
# 关键修复:安装特定版本的uni-app相关依赖
RUN npm install -g @dcloudio/uni-cli-service@latest \
&& npm install @dcloudio/vue-cli-plugin-uni@latest \
&& npm install --legacy-peer-deps && npm install --legacy-peer-deps
# 复制源代码
COPY . .
# 构建应用 # 构建应用
COPY . .
RUN npm run build RUN npm run build
# 生产阶段 # 生产环境
FROM nginx:1.21-alpine FROM nginx:1.21-alpine
COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
......
...@@ -26,12 +26,13 @@ ...@@ -26,12 +26,13 @@
"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/vue-cli-plugin-uni": "2.0.0-27920200624001", "vue": "^2.6.14",
"vue": "^2.6.14" "@dcloudio/uni-app": "2.0.0-27920200624001"
}, },
"devDependencies": { "devDependencies": {
"less": "^4.3.0", "less": "^4.3.0",
"@dcloudio/uni-h5": "2.0.0-27920200624001", "@dcloudio/uni-h5": "2.0.0-27920200624001",
"webpack": "^4.46.0" "@dcloudio/uni-cli-service": "2.0.0-27920200624001",
"@dcloudio/vue-cli-plugin-uni": "2.0.0-27920200624001"
} }
} }
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