# ── Base image ──────────────────────────────────────────────────────────────── FROM node:20-slim # ── System dependencies (needed to compile node-pty used by shellular) ──────── RUN apt-get update && \ apt-get install -y --no-install-recommends python3 make g++ && \ rm -rf /var/lib/apt/lists/* # ── Pin a fixed machine-id ──────────────────────────────────────────────────── # node-machine-id reads /etc/machine-id. By writing a fixed value here the # shellular config seeded from SHELLULAR_HOST_ID / SHELLULAR_KEY env vars will # always match — no re-registration needed across container restarts. RUN echo "d8904b4d338adf83688caac869f64c0b" > /etc/machine-id && \ mkdir -p /var/lib/dbus && \ echo "d8904b4d338adf83688caac869f64c0b" > /var/lib/dbus/machine-id # ── Use the built-in "node" user (UID 1000, matches HF Spaces runtime) ──────── USER node ENV HOME=/home/node \ PATH="/home/node/.npm-global/bin:${PATH}" # ── Install shellular globally ──────────────────────────────────────────────── RUN npm config set prefix /home/node/.npm-global && \ npm install -g shellular # ── App ─────────────────────────────────────────────────────────────────────── WORKDIR /home/node/app COPY --chown=node:node package*.json ./ RUN npm install --omit=dev COPY --chown=node:node . . # ── Runtime ─────────────────────────────────────────────────────────────────── EXPOSE 7860 ENV PORT=7860 CMD ["node", "app.js"]