stevhliu HF Staff commited on
Commit
0ce8cee
·
1 Parent(s): c5358f0

Install with pnpm; npm deadlocks on the Spaces builder

Browse files

Three builds died at exactly 8:00 in npm ci. Probes ruled out the obvious
causes: the registry answers in under a second, and tarballs pull at
163MB/s, so it is neither reachability nor throughput. npm itself hangs
there and the builder kills it at its limit; "Exit handler never called"
is what npm prints when SIGTERMed mid-install.

pnpm installs the same tree in 10s locally. Lockfile imported from
package-lock.json so versions are unchanged, then package-lock.json
removed to avoid two lockfiles drifting apart.

Files changed (4) hide show
  1. Dockerfile +30 -25
  2. package-lock.json +0 -0
  3. package.json +2 -1
  4. pnpm-lock.yaml +0 -0
Dockerfile CHANGED
@@ -1,26 +1,31 @@
1
  # syntax=docker/dockerfile:1
2
- # TEMPORARY diagnostic build — measures tarball throughput, then fails on
3
- # purpose so the logs surface. Restored to the real Dockerfile after.
4
- FROM node:22-slim
5
- RUN node -e "\
6
- const pull = async (u) => { \
7
- const c = new AbortController(); \
8
- const t = setTimeout(() => c.abort(), 60000); \
9
- const t0 = Date.now(); \
10
- try { \
11
- const r = await fetch(u, {signal: c.signal}); \
12
- const b = await r.arrayBuffer(); \
13
- const s = (Date.now() - t0) / 1000; \
14
- console.log((b.byteLength/1048576).toFixed(1)+'MB in '+s.toFixed(1)+'s = '+(b.byteLength/1048576/s).toFixed(2)+'MB/s', u.split('/').pop()); \
15
- } catch (e) { console.log('FAIL', e.name, u.split('/').pop()); } \
16
- finally { clearTimeout(t); } \
17
- }; \
18
- (async () => { \
19
- const reg = 'https://registry.npmjs.org'; \
20
- const meta = await (await fetch(reg+'/@next/swc-linux-x64-gnu')).json(); \
21
- const v = meta.versions['16.3.4'] ? '16.3.4' : meta['dist-tags'].latest; \
22
- await pull(meta.versions[v].dist.tarball); \
23
- const ox = await (await fetch(reg+'/@tailwindcss/oxide-linux-x64-gnu')).json(); \
24
- await pull(ox.versions[ox['dist-tags'].latest].dist.tarball); \
25
- console.log('PROBE DONE'); process.exit(1); \
26
- })()"
 
 
 
 
 
 
1
  # syntax=docker/dockerfile:1
2
+
3
+ FROM node:22-slim AS deps
4
+ WORKDIR /app
5
+ RUN corepack enable
6
+ COPY package.json pnpm-lock.yaml ./
7
+ RUN pnpm install --frozen-lockfile
8
+
9
+ FROM node:22-slim AS builder
10
+ WORKDIR /app
11
+ RUN corepack enable
12
+ COPY --from=deps /app/node_modules ./node_modules
13
+ COPY . .
14
+ ENV NEXT_TELEMETRY_DISABLED=1
15
+ RUN pnpm run build
16
+
17
+ FROM node:22-slim AS runner
18
+ WORKDIR /app
19
+ ENV NODE_ENV=production
20
+ ENV NEXT_TELEMETRY_DISABLED=1
21
+ # Spaces routes traffic to 7860 and runs the container as uid 1000.
22
+ ENV PORT=7860
23
+ ENV HOSTNAME=0.0.0.0
24
+ EXPOSE 7860
25
+
26
+ COPY --from=builder /app/public ./public
27
+ COPY --from=builder --chown=node:node /app/.next/standalone ./
28
+ COPY --from=builder --chown=node:node /app/.next/static ./.next/static
29
+
30
+ USER node
31
+ CMD ["node", "server.js"]
package-lock.json DELETED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -27,5 +27,6 @@
27
  "eslint-config-next": "16.3.4",
28
  "tailwindcss": "^4",
29
  "typescript": "^5"
30
- }
 
31
  }
 
27
  "eslint-config-next": "16.3.4",
28
  "tailwindcss": "^4",
29
  "typescript": "^5"
30
+ },
31
+ "packageManager": "pnpm@10.34.5"
32
  }
pnpm-lock.yaml ADDED
The diff for this file is too large to render. See raw diff