gigafibre-fsm/services/cogeco-checker/Dockerfile
louispaulb 74b89f5490 feat(cogeco-checker): POC competitor-serviceability microservice (WIP)
Playwright/Chromium microservice (mirrors modem-bridge: node:20-slim +
Chromium, token auth, port 3302, serialized + rate-limited) that drives
Cogeco's public address checker to determine if a competitor serves a
given address.

What works (proven on prod):
- Anti-bot bypass: vanilla headless gets 403 on /boutique/api/register
  (reCAPTCHA Enterprise blocks datacenter headless). Adding
  playwright-extra + stealth flips it to 200 — register + autocomplete
  succeed.
- Reaches Cogeco's address system and pulls real autocomplete
  suggestions. Confirmed it's Loqate/AddressComplete (id + next:
  Retrieve/Find shape).

What's NOT reliable yet (do not use the verdict for decisions):
- The serviceability verdict. The Loqate flow is multi-step
  (Find → Retrieve → Cogeco serviceability) and a single option click
  doesn't complete it, so the final yes/no API call isn't captured.
- Current interpret() falls back to scanning UI text and produces FALSE
  POSITIVES (a rural out-of-Cogeco address returned available=true off
  generic marketing copy). Needs the real Retrieve+serviceability
  endpoint wired before it can be trusted.

Next: capture the post-selection Retrieve + serviceability call (likely
needs a "continue" step and handling the multi-dwelling "N Addresses"
branch), then parse the real verdict + speeds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 20:56:05 -04:00

40 lines
1.2 KiB
Docker

# cogeco-checker: Headless Chromium for Cogeco address-availability checker
# ~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 checker && useradd -r -g checker -G audio,video -m checker
COPY package.json .
RUN npm install --production
# Install Chromium as the checker user (so it goes to /home/checker/.cache)
USER checker
RUN npx playwright install chromium 2>&1 | tail -3
USER root
COPY server.js .
COPY lib/ lib/
RUN chown -R checker:checker /app
EXPOSE 3302
USER checker
CMD ["node", "server.js"]