gigafibre-fsm/services/modem-bridge/Dockerfile
louispaulb 607ea54b5c refactor: reduce token count, DRY code, consolidate docs
Backend services:
- targo-hub: extract deepGetValue to helpers.js, DRY disconnect reasons
  lookup map, compact CAPABILITIES, consolidate vision.js prompts/schemas,
  extract dispatch scoring weights, trim section dividers across 9 files
- modem-bridge: extract getSession() helper (6 occurrences), resetIdleTimer(),
  consolidate DM query factory, fix duplicate username fill bug, trim headers
  (server.js -36%, tplink-session.js -47%, docker-compose.yml -57%)

Frontend:
- useWifiDiagnostic: extract THRESHOLDS const, split processDiagnostic into
  6 focused helpers (processOnlineStatus, processWanIPs, processRadios,
  processMeshNodes, processClients, checkRadioIssues)
- EquipmentDetail: merge duplicate ROLE_LABELS, remove verbose comments

Documentation (17 → 13 files, -1,400 lines):
- New consolidated README.md (architecture, services, dependencies, auth)
- Merge ECOSYSTEM-OVERVIEW into ARCHITECTURE.md
- Merge MIGRATION-PLAN + ARCHITECTURE-COMPARE + FIELD-GAP + CHANGELOG → MIGRATION.md
- Merge COMPETITIVE-ANALYSIS into PLATFORM-STRATEGY.md
- Update ROADMAP.md with current phase status
- Delete CONTEXT.md (absorbed into README)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 08:39:58 -04:00

40 lines
1.2 KiB
Docker

# modem-bridge: Headless Chromium for TP-Link ONU web GUI access
# ~450MB total (node:20-slim + Chromium deps)
# Lighter than node:20 + full playwright install (~800MB)
FROM node:20-slim
# Playwright needs these system deps for Chromium
# Install ALL Chromium dependencies in one shot via playwright's own installer
RUN apt-get update && apt-get install -y --no-install-recommends \
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 \
libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
libpango-1.0-0 libcairo2 libasound2 libxshmfence1 \
libxfixes3 libx11-6 libx11-xcb1 libxcb1 libxext6 \
libxrender1 libxi6 libxtst6 libglib2.0-0 libdbus-1-3 \
fonts-liberation \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create non-root user first so playwright installs in their home
RUN groupadd -r bridge && useradd -r -g bridge -G audio,video -m bridge
COPY package.json .
RUN npm install --production
# Install Chromium as the bridge user (so it goes to /home/bridge/.cache)
USER bridge
RUN npx playwright install chromium 2>&1 | tail -3
USER root
COPY server.js .
COPY lib/ lib/
RUN chown -R bridge:bridge /app
EXPOSE 3301
USER bridge
CMD ["node", "server.js"]