Build a WebSocket-only tracker from the official Node image and a locked bittorrent-tracker 11.2.3, run via compose.tracker.yaml and the tracker:up/tracker:down/test:tracker scripts. A small wrapper disables scrape and stats and bounds input: frame validation, per-IP connection and message limits (IPv6 grouped per /64), origin checks, a fixed peer ID and at most four swarms per socket (tracked synchronously, so pipelined frames cannot bypass it), swarm and peer caps, idle-socket timeout and explicit expiry of stale swarm memberships. Forwarded addresses are taken from the rightmost X-Forwarded-For entry and only from trusted proxies. Integration tests use only Node built-ins. Document the planned tracker reconnect design; the app still uses manual connection codes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.0 KiB
Docker
25 lines
1.0 KiB
Docker
# Official Node image; update the digest deliberately alongside tracker checks.
|
|
FROM node:24-bookworm-slim@sha256:a5f4366e834695d5f363b920c104953a535d3a9864d1bdf74566a0ebe01daee5 AS dependencies
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
# Only the server entry point is used. Native client/optional accelerators and
|
|
# package lifecycle scripts are unnecessary for WebSocket tracker operation.
|
|
RUN npm ci --omit=dev --omit=optional --ignore-scripts --no-audit --no-fund \
|
|
&& npm cache clean --force
|
|
|
|
FROM dependencies AS test
|
|
COPY server.mjs healthcheck.mjs test.mjs ./
|
|
USER node
|
|
RUN node --test test.mjs
|
|
|
|
FROM node:24-bookworm-slim@sha256:a5f4366e834695d5f363b920c104953a535d3a9864d1bdf74566a0ebe01daee5 AS runtime
|
|
ENV NODE_ENV=production PORT=8000 DEBUG=""
|
|
WORKDIR /app
|
|
COPY --from=dependencies /app/node_modules ./node_modules
|
|
COPY package.json server.mjs healthcheck.mjs ./
|
|
USER node
|
|
EXPOSE 8000
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD ["node", "healthcheck.mjs"]
|
|
CMD ["node", "server.mjs"]
|