fix: 修复后端接口连接不上问题
All checks were successful
Web UI CI/CD / build-and-deploy (push) Successful in 3m40s
All checks were successful
Web UI CI/CD / build-and-deploy (push) Successful in 3m40s
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -11,10 +11,14 @@ WORKDIR /app
|
||||
# 启用 pnpm (使用 corepack)
|
||||
# 设置环境变量让 Corepack 也从镜像源下载
|
||||
ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com
|
||||
# 设置 pnpm store 路径,便于缓存
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable && corepack prepare pnpm@10.22.0 --activate
|
||||
|
||||
# 配置 pnpm 使用淘宝镜像源
|
||||
RUN pnpm config set registry https://registry.npmmirror.com
|
||||
# 配置 pnpm 使用淘宝镜像源和自定义 store 路径(便于缓存)
|
||||
RUN pnpm config set registry https://registry.npmmirror.com && \
|
||||
pnpm config set store-dir /pnpm/store
|
||||
|
||||
# 单独复制依赖描述文件,利用 Docker 缓存层
|
||||
# 先只复制这些文件,如果它们没变,Docker 会复用缓存,跳过后续步骤
|
||||
@@ -30,8 +34,8 @@ COPY internal internal
|
||||
# 安装依赖
|
||||
# 使用 BuildKit 缓存挂载加速依赖安装
|
||||
# 缓存 pnpm store,即使 package.json 变了,已下载的包也能复用
|
||||
# pnpm store 默认路径:~/.local/share/pnpm/store (Linux)
|
||||
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
|
||||
# 使用明确的缓存路径和 ID,确保缓存持久化
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
# 构建指定项目 (根据 package.json 里的 scripts)
|
||||
|
||||
Reference in New Issue
Block a user