Commit 3d032a88 by zhangxingmin

push

parent faf16f94
...@@ -3,18 +3,18 @@ FROM node:14-alpine AS builder ...@@ -3,18 +3,18 @@ FROM node:14-alpine AS builder
# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app
# 安装系统依赖(uni-app编译可能需要) # 替换Alpine源为国内镜像 + 安装系统依赖
RUN apk add --no-cache python3 make g++ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& 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 config set disturl https://npmmirror.com/dist \
npm config set sass_binary_site https://npmmirror.com/mirrors/node-sass/ && \ && npm config set sass_binary_site https://npmmirror.com/mirrors/node-sass/ \
rm -rf node_modules package-lock.json && \ && npm cache clean --force
npm cache clean --force
# 安装依赖 # 安装依赖 (移除冗余的清理操作)
RUN npm install --legacy-peer-deps RUN npm install --legacy-peer-deps
# 复制源代码 # 复制源代码
...@@ -25,6 +25,10 @@ RUN npm run build ...@@ -25,6 +25,10 @@ RUN npm run build
# 生产阶段 # 生产阶段
FROM nginx:1.21-alpine FROM nginx:1.21-alpine
# 替换生产阶段的Alpine源 (可选)
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
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
EXPOSE 8333 EXPOSE 8333
......
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