soxogvv commited on
Commit
9560ee9
Β·
verified Β·
1 Parent(s): b64654b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -37
Dockerfile CHANGED
@@ -2,71 +2,58 @@
2
  FROM node:20-slim
3
 
4
  # ── System dependencies ───────────────────────────────────────────────────────
5
- # python3 / make / g++ β€” required to compile node-pty (used by shellular)
6
- # python3-pip β€” for yt-dlp and other Python tools
7
- # wget / curl β€” general-purpose download utilities
8
- # git β€” version control
9
- # neofetch β€” system info display
10
- # mediainfo β€” media file metadata inspector
11
  RUN apt-get update && \
12
  apt-get install -y --no-install-recommends \
13
  python3 \
14
  python3-pip \
 
15
  make \
16
  g++ \
17
  wget \
18
  curl \
19
  git \
20
- sudo \
21
  neofetch \
22
  mediainfo \
23
- python3-venv \
24
  screen \
25
- ca-certificates \
26
- openssl \
27
  && rm -rf /var/lib/apt/lists/*
28
 
29
- # ── Passwordless sudo for the node user ──────────────────────────────────────
30
- # Lets you run sudo apt install <pkg> inside the shellular terminal
31
- # without needing a password.
32
- RUN echo "node ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/node && \
33
- chmod 0440 /etc/sudoers.d/node
 
34
 
35
- # ── yt-dlp (installed via pip, break-system-packages is fine in a container) ──
36
- RUN pip3 install --no-cache-dir --break-system-packages yt-dlp
37
 
38
  # ── Pin a stable machine-id ───────────────────────────────────────────────────
39
- # WHY THIS IS HERE (not in secrets):
40
- # β€’ The shellular relay authenticates connections by matching the machineId
41
- # that was used at registration time. The container's /etc/machine-id must
42
- # always hash to the same value as SHELLULAR_MACHINE_ID in HF Secrets.
43
- # β€’ /etc/machine-id must be written as root, at BUILD time. HF Spaces runs
44
- # all containers as UID 1000 at runtime, so it cannot be written then.
45
- # β€’ This value is a stable identifier, NOT a secret or auth token.
46
- # The actual secrets (SHELLULAR_KEY, SHELLULAR_HOST_ID) live in HF Secrets.
47
  RUN echo "d8904b4d338adf83688caac869f64c0b" > /etc/machine-id && \
48
  mkdir -p /var/lib/dbus && \
49
  echo "d8904b4d338adf83688caac869f64c0b" > /var/lib/dbus/machine-id
50
 
51
- # ── Use the built-in "node" user (UID 1000, matches HF Spaces runtime) ────────
52
- USER node
53
- ENV HOME=/home/node \
54
- PATH="/home/node/.npm-global/bin:${PATH}"
 
 
 
 
 
 
55
 
56
  # ── Install shellular globally ────────────────────────────────────────────────
57
- RUN npm config set prefix /home/node/.npm-global && \
58
  npm install -g shellular
59
 
60
  # ── App ───────────────────────────────────────────────────────────────────────
61
- WORKDIR /home/node/app
62
-
63
- COPY --chown=node:node package*.json ./
64
  RUN npm install --omit=dev
65
-
66
- COPY --chown=node:node . .
67
 
68
  # ── Runtime ───────────────────────────────────────────────────────────────────
69
  EXPOSE 7860
70
  ENV PORT=7860
71
-
72
- CMD ["node", "app.js"]
 
2
  FROM node:20-slim
3
 
4
  # ── System dependencies ───────────────────────────────────────────────────────
 
 
 
 
 
 
5
  RUN apt-get update && \
6
  apt-get install -y --no-install-recommends \
7
  python3 \
8
  python3-pip \
9
+ python3-venv \
10
  make \
11
  g++ \
12
  wget \
13
  curl \
14
  git \
 
15
  neofetch \
16
  mediainfo \
 
17
  screen \
18
+ nano \
 
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
+ # ── Install bore (TCP tunnel β€” exposes SSH publicly for Termius) ──────────────
22
+ RUN wget -q "https://github.com/ekzhang/bore/releases/download/v0.5.0/bore-v0.5.0-x86_64-unknown-linux-musl.tar.gz" \
23
+ -O /tmp/bore.tar.gz && \
24
+ tar -xzf /tmp/bore.tar.gz -C /usr/local/bin bore && \
25
+ chmod +x /usr/local/bin/bore && \
26
+ rm /tmp/bore.tar.gz
27
 
28
+ # ── Prepare SSH runtime dirs ──────────────────────────────────────────────────
 
29
 
30
  # ── Pin a stable machine-id ───────────────────────────────────────────────────
 
 
 
 
 
 
 
 
31
  RUN echo "d8904b4d338adf83688caac869f64c0b" > /etc/machine-id && \
32
  mkdir -p /var/lib/dbus && \
33
  echo "d8904b4d338adf83688caac869f64c0b" > /var/lib/dbus/machine-id
34
 
35
+ # ── Set HOME for root ─────────────────────────────────────────────────────────
36
+ ENV HOME=/root \
37
+ PATH="/root/.npm-global/bin:/root/venv/bin:${PATH}" \
38
+ VIRTUAL_ENV=/root/venv \
39
+ PIP_NO_CACHE_DIR=1
40
+
41
+ # ── Create a persistent Python venv ──────────────────────────────────────────
42
+ RUN python3 -m venv /root/venv && \
43
+ /root/venv/bin/pip install --upgrade pip && \
44
+ /root/venv/bin/pip install huggingface_hub
45
 
46
  # ── Install shellular globally ────────────────────────────────────────────────
47
+ RUN npm config set prefix /root/.npm-global && \
48
  npm install -g shellular
49
 
50
  # ── App ───────────────────────────────────────────────────────────────────────
51
+ WORKDIR /root/app
52
+ COPY package*.json ./
 
53
  RUN npm install --omit=dev
54
+ COPY . .
 
55
 
56
  # ── Runtime ───────────────────────────────────────────────────────────────────
57
  EXPOSE 7860
58
  ENV PORT=7860
59
+ CMD ["node", "app.js"]