chore: Update Dockerfile and pnpm configuration to enable build scripts for dependencies
Build and Push Reader Image / docker (push) Successful in 1m9s

This commit is contained in:
2026-05-11 15:49:24 +07:00
parent 7ad39b3639
commit 09734cdadd
3 changed files with 12 additions and 18 deletions
+2 -6
View File
@@ -1,12 +1,8 @@
# Stage 1: Dependencies # Stage 1: Dependencies
FROM node:22-alpine AS deps FROM node:22-alpine AS deps
WORKDIR /app WORKDIR /app
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
# pnpm v10+ có cơ chế "approve build scripts"; CI/Docker không tương tác được. RUN corepack enable pnpm && pnpm install --frozen-lockfile
# Dòng dưới đảm bảo Prisma/Sharp được phép build khi cài deps.
RUN corepack enable pnpm \
&& pnpm approve-builds --all \
&& pnpm install --frozen-lockfile
# Stage 2: Builder # Stage 2: Builder
FROM node:22-alpine AS builder FROM node:22-alpine AS builder
+1 -8
View File
@@ -81,12 +81,5 @@
"tw-animate-css": "1.3.3", "tw-animate-css": "1.3.3",
"typescript": "5.7.3" "typescript": "5.7.3"
}, },
"pnpm": { "pnpm": {}
"onlyBuiltDependencies": [
"@prisma/client",
"@prisma/engines",
"prisma",
"sharp"
]
}
} }
+9 -4
View File
@@ -1,5 +1,10 @@
packages:
- "."
# pnpm v10+ có cơ chế chặn build scripts trong môi trường không tương tác.
# Whitelist các package cần build (Prisma/Sharp) để CI/Docker không fail với ERR_PNPM_IGNORED_BUILDS.
allowBuilds: allowBuilds:
'@prisma/client': false "@prisma/client": true
'@prisma/engines': false "@prisma/engines": true
prisma: false prisma: true
sharp: false sharp: true