Skip to content

Commit addf0d1

Browse files
committed
update Dockerfile.CI
1 parent c402c96 commit addf0d1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docker/Dockerfile.CI

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,22 @@ FROM node:24-alpine
33
WORKDIR /app
44
ENV NODE_ENV=production
55

6-
# 1. 在一个干净的目录下只安装 sharp
7-
# 这样 npm 不会去扫描项目的 package.json,也就不会有依赖冲突
6+
# 1. 独立安装 sharp
87
RUN mkdir -p /app/sharp-install && \
98
cd /app/sharp-install && \
109
npm install sharp --os=linux --libc=musl --cpu=arm64
1110

12-
# 2. 拷贝 Next.js 产物到 /app
11+
# 2. 拷贝 Next.js 产物
1312
COPY .next/standalone ./
1413
COPY .next/static ./.next/static
1514
COPY public ./public
1615

17-
# 3. 将安装好的 sharp 移动到正确的位置
18-
# 或者直接设置路径指向它
19-
RUN mkdir -p node_modules && \
16+
# 3. 确保目标目录干净,并拷贝 sharp
17+
RUN rm -rf ./node_modules/sharp && \
18+
mkdir -p ./node_modules && \
2019
cp -r /app/sharp-install/node_modules/sharp ./node_modules/
2120

22-
# 4. 强制 Next.js 使用这个特定的 sharp
21+
# 4. 指向 sharp 路径
2322
ENV NEXT_SHARP_PATH=/app/node_modules/sharp
2423

2524
EXPOSE 3000

0 commit comments

Comments
 (0)