fix(docker): use bun install (npm reads stale lockfile → react 18) + .dockerignore

Docker build failed at npm run build: stale package-lock.json pins
react@18 while next@16 requires react@19. Switch builder to bun install
(bun.lock is current). Add .dockerignore (was shipping 700MB context).
This commit is contained in:
lezi-fun committed 2026-08-11 17:56:42 +08:00
1 parent dce94fd5af
commit a53304cefa
2 files changed
+15 -3

No files matched your search

+6 -3
View File
@@ -7,13 +7,16 @@ FROM node:20-alpine AS builder
WORKDIR /app
ENV DOCKER=1
# 用 bun 装依赖(bun.lock 最新;npm 会读旧的 package-lock.json → react 18 → 构建失败)
RUN npm i -g bun
# 先装依赖(利用缓存)
COPY package.json package-lock.json* bun.lock* ./
RUN npm install
COPY package.json bun.lock* package-lock.json* ./
RUN bun install
# 复制源码并构建
COPY . .
RUN npm run build
RUN bun run build
# ---- 运行阶段 ----
FROM node:20-alpine AS runner