techprotrade commited on
Commit
52239b4
·
verified ·
1 Parent(s): 4124924

Fix npm install: ignore-scripts + no postinstall

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -2
  2. package.json +0 -1
Dockerfile CHANGED
@@ -7,7 +7,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7
  python3 make g++ \
8
  && rm -rf /var/lib/apt/lists/*
9
  COPY package.json package-lock.json ./
10
- RUN npm ci --legacy-peer-deps || npm install --legacy-peer-deps
 
 
11
 
12
  FROM node:20-bookworm-slim AS builder
13
  WORKDIR /app
@@ -16,6 +18,8 @@ ENV NEXT_TELEMETRY_DISABLED=1 \
16
  NODE_OPTIONS=--max-old-space-size=4096
17
  COPY --from=deps /app/node_modules ./node_modules
18
  COPY . .
 
 
19
  ARG NEXT_PUBLIC_API_URL=
20
  ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
21
  RUN npm run build
@@ -27,7 +31,7 @@ ENV NODE_ENV=production \
27
  PORT=7860 \
28
  HOSTNAME=0.0.0.0
29
 
30
- # node:20 image already has uid/gid 1000 (user "node") — reuse it for HF Spaces
31
  COPY --from=builder --chown=node:node /app/public ./public
32
  COPY --from=builder --chown=node:node /app/.next/standalone ./
33
  COPY --from=builder --chown=node:node /app/.next/static ./.next/static
 
7
  python3 make g++ \
8
  && rm -rf /var/lib/apt/lists/*
9
  COPY package.json package-lock.json ./
10
+ # ignore-scripts: postinstall needs full source (scripts/) which is not present yet
11
+ RUN npm ci --legacy-peer-deps --ignore-scripts \
12
+ || npm install --legacy-peer-deps --ignore-scripts
13
 
14
  FROM node:20-bookworm-slim AS builder
15
  WORKDIR /app
 
18
  NODE_OPTIONS=--max-old-space-size=4096
19
  COPY --from=deps /app/node_modules ./node_modules
20
  COPY . .
21
+ # Optional reactflow repair after full tree is present
22
+ RUN node scripts/verify-reactflow.js || true
23
  ARG NEXT_PUBLIC_API_URL=
24
  ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
25
  RUN npm run build
 
31
  PORT=7860 \
32
  HOSTNAME=0.0.0.0
33
 
34
+ # node:20 image already has uid/gid 1000 (user "node")
35
  COPY --from=builder --chown=node:node /app/public ./public
36
  COPY --from=builder --chown=node:node /app/.next/standalone ./
37
  COPY --from=builder --chown=node:node /app/.next/static ./.next/static
package.json CHANGED
@@ -21,7 +21,6 @@
21
  "coverage:trend:update": "node scripts/coverage-trend-tracker.js update",
22
  "coverage:trend:report": "node scripts/coverage-trend-tracker.js report",
23
  "coverage:trend:html": "node scripts/coverage-trend-tracker.js html",
24
- "postinstall": "node scripts/verify-reactflow.js",
25
  "analyze": "ANALYZE=true npm run build",
26
  "lighthouse": "lhci autorun --upload.target=temporary-public-storage",
27
  "lighthouse:ci": "lhci autorun",
 
21
  "coverage:trend:update": "node scripts/coverage-trend-tracker.js update",
22
  "coverage:trend:report": "node scripts/coverage-trend-tracker.js report",
23
  "coverage:trend:html": "node scripts/coverage-trend-tracker.js html",
 
24
  "analyze": "ANALYZE=true npm run build",
25
  "lighthouse": "lhci autorun --upload.target=temporary-public-storage",
26
  "lighthouse:ci": "lhci autorun",