fix: 添加bcrypt原生编译支持

user-service和evolution-service使用bcrypt需要原生编译,
添加python3/make/g++编译工具,安装后删除以减小镜像体积

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-09 09:12:32 -08:00
parent 2f9fd3995b
commit 4b6778cc29
2 changed files with 8 additions and 4 deletions

View File

@ -36,10 +36,12 @@ COPY --from=builder /app/packages/shared/dist ./node_modules/@iconsulting/shared
COPY --from=builder /app/packages/shared/package.json ./node_modules/@iconsulting/shared/
# 移除 workspace: 协议依赖并安装生产依赖
RUN apk add --no-cache jq && \
# bcrypt 需要原生编译,安装编译工具
RUN apk add --no-cache jq python3 make g++ && \
jq 'del(.dependencies["@iconsulting/shared"])' package.json > package.tmp.json && \
mv package.tmp.json package.json && \
npm install --omit=dev --ignore-scripts
npm install --omit=dev && \
apk del python3 make g++
ENV NODE_ENV=production
ENV PORT=3005

View File

@ -47,10 +47,12 @@ COPY --from=builder /app/packages/shared/dist ./node_modules/@iconsulting/shared
COPY --from=builder /app/packages/shared/package.json ./node_modules/@iconsulting/shared/
# 移除 workspace: 协议依赖并安装生产依赖
RUN apk add --no-cache jq && \
# bcrypt 需要原生编译,安装编译工具
RUN apk add --no-cache jq python3 make g++ && \
jq 'del(.dependencies["@iconsulting/shared"])' package.json > package.tmp.json && \
mv package.tmp.json package.json && \
npm install --omit=dev --ignore-scripts
npm install --omit=dev && \
apk del python3 make g++
# 设置环境变量
ENV NODE_ENV=production