fm1320 commited on
Commit
d4ff4a4
·
1 Parent(s): ffe59ba

Dockerfile: multi-stage Node install (HF apt sandbox workaround)

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -9
Dockerfile CHANGED
@@ -4,19 +4,26 @@
4
  # This Dockerfile is HF Spaces specific. Local Docker users should use
5
  # compose.yml (which just runs the unmodified upstream SIE image with the
6
  # Node UI on the host).
 
 
 
 
 
 
 
 
 
 
7
  FROM ghcr.io/superlinked/sie-server:latest-cpu-default
8
 
9
  USER root
10
 
11
- # Node 22 for the UI server (tsx + node:http + our Express-free server.ts)
12
- # The SIE base image is minimal; install curl + ca-certificates before
13
- # pulling NodeSource's setup script.
14
- RUN apt-get update \
15
- && apt-get install -y --no-install-recommends curl ca-certificates gnupg \
16
- && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
17
- && apt-get install -y --no-install-recommends nodejs \
18
- && apt-get clean \
19
- && rm -rf /var/lib/apt/lists/*
20
 
21
  # HF Spaces' persistent storage lives at /data (50 GB free tier).
22
  # Send the HuggingFace cache there so model weights survive Space restarts.
 
4
  # This Dockerfile is HF Spaces specific. Local Docker users should use
5
  # compose.yml (which just runs the unmodified upstream SIE image with the
6
  # Node UI on the host).
7
+ #
8
+ # We use a multi-stage build to grab Node binaries from the official
9
+ # node:22-bookworm-slim image. HF Spaces' build sandbox restricts apt-key
10
+ # tmp-file writes, so installing Node via apt fails. Copy approach avoids
11
+ # apt entirely.
12
+
13
+ # --- stage 1: pull Node binaries ---
14
+ FROM node:22-bookworm-slim AS node
15
+
16
+ # --- stage 2: final image ---
17
  FROM ghcr.io/superlinked/sie-server:latest-cpu-default
18
 
19
  USER root
20
 
21
+ # Copy Node 22 from the official image (no apt, no apt-key).
22
+ COPY --from=node /usr/local/bin/node /usr/local/bin/node
23
+ COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
24
+ RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
25
+ && ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
26
+ && node --version && npm --version
 
 
 
27
 
28
  # HF Spaces' persistent storage lives at /data (50 GB free tier).
29
  # Send the HuggingFace cache there so model weights survive Space restarts.