Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

feat(server): Dockerfile for Server Edition (Dokploy/PaaS deploys)

enes041057f37827
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..7a73f242b
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,20 @@
+# Keep the build context to what `npm run build` + `npm run server:build` actually read:
+# src/, package*.json, the tsconfigs and electron.vite.config.ts.
+node_modules
+out
+dist
+.git
+.claude
+.nodeterm
+build
+site
+docs
+test
+scripts
+Dockerfile
+.dockerignore
+*.md
+*.png
+*.tsbuildinfo
+*.log
+LICENSE
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..1629f57fc
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,62 @@
+# nodeterm Server Edition — container image (browser canvas backed by the headless server).
+#
+# The one real trap in here is node-pty's ABI: the repo's `postinstall` runs
+# `electron-rebuild -f -w node-pty`, which compiles node-pty against ELECTRON's ABI — but the
+# server runs under plain `node`, which would crash at boot with a NODE_MODULE_VERSION mismatch.
+# So every npm install below uses --ignore-scripts and the deps stage compiles node-pty against
+# Node's own ABI with an explicit `npm rebuild node-pty`. Keep the deps and runtime stages on the
+# SAME Node major (the compiled binary must match the runtime ABI).
+#
+# TLS is terminated by the reverse proxy in front (Dokploy/Traefik, nginx, Caddy…): the server
+# speaks plain HTTP inside the Docker network, which is why CMD passes --insecure-http (the
+# server refuses a non-loopback bind without it). It sets the Secure cookie flag by itself when
+# the proxy forwards X-Forwarded-Proto: https. Do NOT publish the container port directly on a
+# public interface.
+
+# ---- build: renderer + server bundle (needs devDependencies, no native builds) ----
+FROM node:22-bookworm AS build
+WORKDIR /app
+COPY package.json package-lock.json ./
+# --ignore-scripts skips electron-rebuild AND electron's own binary download (not needed to build)
+RUN npm ci --ignore-scripts
+COPY . .
+RUN npm run build && npm run server:build
+
+# ---- deps: production node_modules with node-pty compiled for Node (toolchain lives here) ----
+FROM node:22-bookworm AS deps
+WORKDIR /app
+COPY package.json package-lock.json ./
+RUN npm ci --omit=dev --ignore-scripts && npm rebuild node-pty
+
+# ---- runtime: slim image, no compilers ----
+FROM node:22-bookworm-slim
+# tmux: terminal session continuity (without it PtyManager falls back to a plain shell).
+# git: the Source Control panel. curl: the managed agent-hook scripts POST through it,
+# and the HEALTHCHECK uses it. ca-certificates: git/curl over https.
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends tmux git curl ca-certificates \
+ && rm -rf /var/lib/apt/lists/*
+WORKDIR /app
+COPY --from=deps /app/node_modules ./node_modules
+COPY --from=build /app/out ./out
+COPY package.json ./
+
+# Auth, sessions, workspace, settings and scrollback snapshots live here — mount a volume or
+# every restart forgets the password and the canvas. NOTE: the tmux server itself lives INSIDE
+# the container, so a container restart/redeploy kills all tmux sessions (unlike the desktop,
+# where only a machine reboot does); the cold-restore path replays scrollback and resumes
+# resumable agents from /data on the next attach.
+ENV NODETERM_DATA_DIR=/data \
+ NODETERM_HOST=0.0.0.0 \
+ NODETERM_PORT=8443
+VOLUME /data
+EXPOSE 8443
+
+# /login is served without auth — a cheap liveness probe.
+HEALTHCHECK --interval=30s --timeout=5s --start-period=15s \
+ CMD curl -fsS "http://127.0.0.1:${NODETERM_PORT}/login" > /dev/null || exit 1
+
+# Seed the first-boot password via NODETERM_SERVER_PASSWORD (ignored once one exists) — with no
+# TTY attached nobody would see the printed one-time setup URL. Exec form: node is PID 1, so
+# docker stop's SIGTERM reaches it directly.
+CMD ["node", "out/server/main.cjs", "--insecure-http"]
diff --git a/docs/SERVER.md b/docs/SERVER.md
index 27c2f21bc..42a4a1128 100644
--- a/docs/SERVER.md
+++ b/docs/SERVER.md
@@ -104,6 +104,43 @@ proxy forwards HTTPS (detected via `X-Forwarded-Proto` / the request being TLS).
`--insecure-http` only exists as an explicit, eyes-open escape hatch for trusted
private networks — prefer the proxy.
+### Docker / Dokploy
+
+The repo ships a multi-stage `Dockerfile` (root) that builds the renderer + server bundle and
+produces a slim runtime image with `tmux`, `git` and `curl` (the managed hook scripts POST
+through curl). Any Dockerfile-based PaaS (Dokploy, Coolify, plain compose) can deploy it:
+
+```bash
+docker build -t nodeterm-server .
+docker run -d -p 8443:8443 \
+ -e NODETERM_SERVER_PASSWORD='choose-a-strong-one' \
+ -v nodeterm-data:/data \
+ nodeterm-server
+```
+
+On Dokploy specifically: create an app from this repo (Dockerfile build), attach a volume at
+`/data`, set `NODETERM_SERVER_PASSWORD`, and point a domain at container port `8443` — Traefik
+terminates TLS and forwards `X-Forwarded-Proto`, so the session cookie gets its `Secure` flag
+and the clipboard runs in a secure context.
+
+Things the image decides for you (see the Dockerfile comments for the full why):
+
+- **node-pty is compiled against Node's ABI, not Electron's.** The repo's `postinstall` runs
+ `electron-rebuild`, which targets Electron — every install in the image uses
+ `--ignore-scripts` plus an explicit `npm rebuild node-pty`. Don't "simplify" that away.
+- **`--insecure-http` is passed** because the container must bind `0.0.0.0` for the proxy to
+ reach it, and TLS lives in the proxy. Never publish the port directly on a public interface.
+- **A container restart/redeploy kills the tmux server** (it lives inside the container). The
+ cold-restore path bridges it — scrollback replays from the `/data` snapshot and resumable
+ agents relaunch with `--resume` — but running processes die with each deploy. This is the one
+ behavioral difference from a long-lived host install, where only a machine reboot does that.
+- **`/data` must be a volume** — auth, sessions, workspace and scrollback snapshots live there;
+ without it every restart forgets the password and the canvas.
+
+Agent CLIs (`claude` etc.) are not baked into the image — install them into the running
+container (or extend the image) and authenticate inside a terminal node; their config lives
+under the container user's home, so consider a volume there too if you rely on them.
+
### CSP
The inline login/setup pages carry a strict CSP. The built `index.html` ships with a