Commit 896ee41f by zhangxingmin

push

parent 53c634fa
...@@ -2,22 +2,25 @@ FROM node:14-alpine AS builder ...@@ -2,22 +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++
# 复制并安装依赖 # 复制依赖描述文件
COPY package*.json ./ COPY package.json package-lock.json ./
# 配置npm镜像并安装项目依赖(优先用本地依赖,不全局安装)
RUN npm config set registry https://registry.npmmirror.com \ RUN npm config set registry https://registry.npmmirror.com \
&& npm install -g @dcloudio/uni-cli-service@2.0.0-27920200624001 --registry=https://registry.npmjs.org \ && npm config set disturl https://npmmirror.com/dist \
&& npm install @dcloudio/vue-cli-plugin-uni@2.0.0-27920200624001 --registry=https://registry.npmjs.org \ && npm install --legacy-peer-deps # 解决Vue 2与部分依赖的peer冲突
&& npm install --legacy-peer-deps
# 构建应用 # 复制源代码(依赖安装后再复制,利用缓存)
COPY . . COPY . .
RUN npm run build
# 生产环境 # 构建H5应用(使用项目本地安装的uni-cli-service)
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-27920200624001" "@dcloudio/uni-app": "2.0.0-alpha-30520210826001",
}, },
"devDependencies": { "devDependencies": {
"less": "^4.3.0", "@dcloudio/uni-h5": "2.0.0-alpha-30520210826001",
"@dcloudio/uni-h5": "2.0.0-27920200624001", "@dcloudio/uni-cli-service": "2.0.0-alpha-30520210826001",
"@dcloudio/uni-cli-service": "2.0.0-27920200624001", "@dcloudio/vue-cli-plugin-uni": "2.0.0-alpha-30520210826001",
"@dcloudio/vue-cli-plugin-uni": "2.0.0-27920200624001" "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