Commit b20716fb by zhangxingmin

push

parent 2a8a2528
...@@ -2,25 +2,25 @@ FROM node:14-alpine AS builder ...@@ -2,25 +2,25 @@ 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++
# 复制依赖描述文件 # 只复制package.json(避免lockfile版本冲突)
COPY package.json package-lock.json ./ COPY package.json ./
# 配置npm镜像并安装项目依赖(优先用本地依赖,不全局安装) # 关键:先验证版本是否存在,不存在则切换官方源重试
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 config set disturl https://npmmirror.com/dist \
&& npm install --legacy-peer-deps # 解决Vue 2与部分依赖的peer冲突 # 验证uni-app版本是否存在,不存在则切换官方源
&& (npm view @dcloudio/uni-app@2.0.0-30920220418001 version >/dev/null 2>&1 || npm config set registry https://registry.npmjs.org) \
&& npm install --legacy-peer-deps
# 复制源代码(依赖安装后再复制,利用缓存) # 复制源代码并构建
COPY . . COPY . .
# 构建H5应用(使用项目本地安装的uni-cli-service)
RUN npm run build:h5 RUN npm run build:h5
# 生产环境:Nginx部署 # 生产环境
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
......
...@@ -27,12 +27,12 @@ ...@@ -27,12 +27,12 @@
"js-sha256": "^0.11.1", "js-sha256": "^0.11.1",
"nanoid": "^4.0.0", "nanoid": "^4.0.0",
"vue": "^2.6.14", "vue": "^2.6.14",
"@dcloudio/uni-app": "2.0.0-alpha-30520210826001" "@dcloudio/uni-app": "2.0.0-30920220418001"
}, },
"devDependencies": { "devDependencies": {
"@dcloudio/uni-h5": "2.0.0-alpha-30520210826001", "@dcloudio/uni-h5": "2.0.0-30920220418001",
"@dcloudio/uni-cli-service": "2.0.0-alpha-30520210826001", "@dcloudio/uni-cli-service": "2.0.0-30920220418001",
"@dcloudio/vue-cli-plugin-uni": "2.0.0-alpha-30520210826001", "@dcloudio/vue-cli-plugin-uni": "2.0.0-30920220418001"
"less": "^4.3.0" "less": "^4.3.0"
} }
} }
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