File size: 2,107 Bytes
6d92394 4d86073 6d92394 4d86073 8a294ef 6d92394 4d86073 8a294ef 6d92394 8a294ef 6d92394 8a294ef 6d92394 8a294ef 6d92394 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # ββ 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"]
|