fix:dockerfile

This commit is contained in:
2025-11-13 15:12:21 +08:00
parent 6b10065e5b
commit 4a43437d19

View File

@@ -22,6 +22,9 @@ COPY apps/backend/package.json ./apps/backend/
RUN pnpm config set store-dir /app/.pnpm-store \
&& pnpm config set registry ${NPM_CONFIG_REGISTRY}
# Ensure no lifecycle scripts run (e.g. sharp postinstall)
RUN pnpm config set ignore-scripts true
# Prefetch only backend dependencies, then install offline without running scripts
RUN --mount=type=cache,id=pnpm-store,target=/app/.pnpm-store \
pnpm fetch --filter ./apps/backend \
@@ -39,6 +42,7 @@ COPY apps/backend/package.json ./apps/backend/
# Bring over the prefetched store and deploy production deps offline
COPY --from=deps /app/.pnpm-store /app/.pnpm-store
RUN pnpm config set store-dir /app/.pnpm-store \
&& pnpm config set ignore-scripts true \
&& pnpm --offline deploy --filter ./apps/backend --prod --ignore-scripts /app/apps/backend
COPY --from=build /app/apps/backend/dist ./apps/backend/dist
WORKDIR /app/apps/backend