Files
remote-control-support-webapp/Dockerfile
T
rmancinasandClaude Opus 5 cfda6b19b7 feat(install): one-command device registration for macOS, Windows and Linux
Registering a machine meant reading a multi-step page, installing Node, and
running three commands in the right order. Now it is one line per platform.

The hub serves scripts/install.sh and scripts/install.ps1 with its own address
and the enrolment token substituted in, so the published command carries
everything and there is nothing to fill in:

  curl -fsSL https://support.freakma.com/install.sh?token=TOKEN | sh
  irm https://support.freakma.com/install.ps1?token=TOKEN | iex

That output is piped straight into a shell, so the token — the only untrusted
value in either file — is refused unless it matches the base64url shape that
randomToken produces.

Each script checks for a usable runtime and stops with instructions rather than
guessing, warns when nothing is serving RFB on the loopback, installs per-user
with no root or administrator, and registers a login-scoped service: launchd on
macOS, a lingering systemd user service on Linux, a logon task on Windows. The
Windows script uses Node 22 when it is present and falls back to the bundled
executable otherwise, which is what lets one command cover both Windows 11 and
Server 2008 R2.

It registers a logon task rather than a service on purpose: services run in
session 0 and cannot draw on the interactive desktop, so the "ask first" consent
prompt would never appear.

Also adds /docs — a per-OS setup guide with service management and a
troubleshooting table — and reworks the enrolment page into OS tabs that open on
whichever platform the reader is sitting at.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-12 11:37:12 -07:00

41 lines
1.2 KiB
Docker

# Machines that cannot run Node 22 still need an agent. Windows Server 2008 R2
# and Windows 7 top out at Node 13, so the same agent.js is bundled with a Node
# 12 runtime into a single .exe the hub serves from /download/agent.exe.
FROM node:22-alpine AS agent-exe
WORKDIR /build
COPY agent ./agent
# `ws` stands in for the global WebSocket the old runtime does not have; pkg
# follows the literal require in agent.js and bundles it.
RUN npm install --no-save --no-audit --no-fund ws@8.18.0 \
&& npx --yes pkg@5.8.1 agent/agent.js \
--targets node12-win-x64 \
--output dist/rcs-agent.exe
FROM node:22-alpine
# node:sqlite is built into Node 22, so there are no native modules to compile
# and no build stage to carry around.
ENV NODE_ENV=production \
PORT=8080 \
DB_PATH=/data/rcs.db
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml* ./
RUN pnpm install --prod --frozen-lockfile
COPY server ./server
COPY public ./public
COPY agent ./agent
COPY scripts ./scripts
COPY --from=agent-exe /build/dist/rcs-agent.exe ./dist/rcs-agent.exe
VOLUME ["/data"]
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s \
CMD wget -qO- http://127.0.0.1:8080/api/health || exit 1
CMD ["node", "server/index.js"]