Commit faf16f94 by zhangxingmin

push

parent 91170006
# 使用 Node 镜像构建
FROM node:14-alpine AS builder FROM node:14-alpine AS builder
# 设置工作目录
WORKDIR /app WORKDIR /app
# 安装系统依赖(uni-app编译可能需要)
RUN apk add --no-cache python3 make g++
# 复制包文件并设置镜像源
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm config set registry https://registry.npmmirror.com && \
npm config set disturl https://npmmirror.com/dist && \
npm config set sass_binary_site https://npmmirror.com/mirrors/node-sass/ && \
rm -rf node_modules package-lock.json && \
npm cache clean --force
# 安装依赖
RUN npm install --legacy-peer-deps
# 复制源代码
COPY . . COPY . .
# 生成 dist/build/h5 目录
# 构建应用
RUN npm run build RUN npm run build
# 使用 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 # 复制 Nginx 配置 COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8333 EXPOSE 8333
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
...@@ -26,13 +26,12 @@ ...@@ -26,13 +26,12 @@
"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": "^2.0.0", "@dcloudio/vue-cli-plugin-uni": "2.0.0-27920200624001",
"@dcloudio/uni-h5": "^2.0.0",
"vue": "^2.6.14" "vue": "^2.6.14"
}, },
"devDependencies": { "devDependencies": {
"less": "^4.3.0", "less": "^4.3.0",
"@dcloudio/vue-cli-plugin-uni": "^2.0.0", "@dcloudio/uni-h5": "2.0.0-27920200624001",
"webpack": "^4.46.0" "webpack": "^4.46.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