fix: Dockerfile 兼容 Debian 基础镜像
Some checks failed
CI/CD Pipeline / Code Quality (push) Successful in 15s
CI/CD Pipeline / Unit Tests (push) Successful in 10s
CI/CD Pipeline / Build Test Image (push) Has been skipped
CI/CD Pipeline / Deploy to Test (push) Has been skipped
CI/CD Pipeline / Build Production Image (push) Failing after 10s
CI/CD Pipeline / Deploy to Production (push) Has been skipped

- addgroup/adduser → groupadd/useradd (Alpine → Debian)
- 安装 curl 用于健康检查
This commit is contained in:
Wang Zhuoxuan 2026-04-17 16:17:44 +08:00
parent 2d8b07845f
commit f390e23ba7

View File

@ -23,9 +23,12 @@ RUN bun run build
FROM oven/bun:1.3 AS release FROM oven/bun:1.3 AS release
WORKDIR /app WORKDIR /app
# 创建非 root 用户 # 创建非 root 用户Debian 兼容命令)
RUN addgroup --system --gid 1001 nodejs RUN groupadd --system --gid 1001 nodejs && \
RUN adduser --system --uid 1001 bun useradd --system --uid 1001 --gid nodejs --no-create-home --shell /usr/sbin/nologin bun
# 安装 curl用于健康检查
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
# 复制生产依赖和构建产物 # 复制生产依赖和构建产物
COPY --from=install /app/node_modules ./node_modules COPY --from=install /app/node_modules ./node_modules