fix: git-config

This commit is contained in:
luo
2026-07-24 12:11:03 +08:00
parent 59696a7e8e
commit ad3c9b964d
4 changed files with 29 additions and 11 deletions

View File

@@ -9,14 +9,17 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 设置工作目录
WORKDIR /build
# 设置 npm 镜像源
RUN npm config set registry https://registry.npmmirror.com
# 安装 pnpm
RUN corepack enable && corepack prepare pnpm@10.15.0 --activate
# 复制 package.json利用 Docker 缓存)
COPY package.json ./
# 设置 pnpm 镜像源
RUN pnpm config set registry https://registry.npmmirror.com
# 复制 package.json 和 pnpm-lock.yaml利用 Docker 缓存)
COPY package.json pnpm-lock.yaml ./
# 安装所有依赖
RUN npm install --legacy-peer-deps
RUN pnpm install --frozen-lockfile
# 安装 git (用于获取 commit 信息)
RUN apk add --no-cache git
@@ -24,21 +27,18 @@ RUN apk add --no-cache git
# 复制源代码
COPY . .
# 列出文件确认复制成功
RUN ls -la
# 创建 src 目录软链接 (兼容 uni-app 新版本)
RUN mkdir -p src && \
ln -sf /build/manifest.json /build/src/manifest.json && \
ln -sf /build/pages.json /build/src/pages.json
# 构建 H5 生产版本
RUN npm run build:h5
RUN pnpm run build:h5
# ================================
# 阶段 2: 运行阶段
# ================================
FROM --platform=linux/amd64 nginx:alpine
FROM --platform=linux/amd64 nginx:1.31.2-alpine
# 使用阿里云镜像源加速
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories