Commit bb9120bf by zhangxingmin

push

parent 25e97d61
# 使用更新的基础镜像 (Debian bullseye) # 使用 Node.js 18 基础镜像 (Debian bullseye)
FROM docker.m.daocloud.io/library/node:16-bullseye AS build FROM docker.m.daocloud.io/library/node:18-bullseye AS build
# 设置环境变量 # 设置环境变量
ENV npm_config_canvas_binary_host_mirror="https://npmmirror.com/mirrors/canvas" ENV npm_config_canvas_binary_host_mirror="https://npmmirror.com/mirrors/canvas"
...@@ -29,22 +29,15 @@ WORKDIR /app ...@@ -29,22 +29,15 @@ WORKDIR /app
# 复制包管理文件 # 复制包管理文件
COPY package.json ./ COPY package.json ./
# 1. 显式安装 esbuild 二进制 # 安装项目依赖
RUN npm install @esbuild/linux-x64 --verbose --registry=https://registry.npmmirror.com
# 2. 安装其他原生模块
RUN npm install canvas@2.11.2 --verbose --ignore-scripts
RUN npm install sharp@0.32.6 --verbose --ignore-scripts
# 3. 安装项目依赖(移除 --no-optional)
RUN npm install --verbose --registry=https://registry.npmmirror.com RUN npm install --verbose --registry=https://registry.npmmirror.com
# 4. 验证 esbuild 安装 # 复制源码和环境配置文件
RUN ls -la node_modules/esbuild/bin && \
./node_modules/.bin/esbuild --version
# 复制源码并构建
COPY . . COPY . .
# 确保环境文件被正确复制
COPY .env.testelopment .env.testelopment
# 使用测试环境构建
RUN npm run build:test RUN npm run build:test
# 生产阶段 # 生产阶段
......
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