Files
board-viewer/deploy/Dockerfile.build
vitya 469ff112cc feat(polish): close all 6 review nitpicks in one sweep
closes board-viewer-polish

- M1 src/parser.ts: comment explaining why **Status:** text field is intentionally
  ignored (emoji is canonical, prevents future-reader head-scratch)
- M2 src/render.ts + tests: clamp future ISO to '0m' (server clock drift safety)
  + inline comment + test
- M3 .tasks/board-viewer-gitea-reader.md: decisions-log clarifying orphan
  per-task files are out of scope by design (STATUS.md = index of record)
- M4 static/board.{js,css} + src/render.ts: filter rebuilt to query records
  (not DOM badge text); 5 status-filter pill buttons in header with active
  toggle state; smoke-verified blocked filter
- M5 deploy/Dockerfile.build: HEALTHCHECK (file fresher than 2×tick) and
  stderr redirect for failures with timestamp
- M6 src/reader.ts: parallelize getLatestCommitIso per-repo via Promise.all
  (preserves block order)

49 tests pass (was 43 pre-polish), typecheck clean, smoke against real Gitea
returns 81 records from 4 repos.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 15:46:47 +03:00

26 lines
1.0 KiB
Docker

FROM node:22-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=optional --no-audit --no-fund
COPY tsconfig.json vitest.config.ts ./
COPY src ./src
COPY static ./static
ENV BOARD_DIST_DIR=/output
ENV BOARD_TICK_SEC=300
# Healthcheck: index.html exists AND was written within the last (tick * 2)s.
# If render is stuck, container goes unhealthy → operator sees it in
# `docker ps` and `docker compose ps` without parsing logs.
HEALTHCHECK --interval=60s --timeout=10s --start-period=120s --retries=2 \
CMD [ -f /output/index.html ] \
&& [ $(( $(date +%s) - $(stat -c %Y /output/index.html) )) -lt $((BOARD_TICK_SEC * 2)) ] \
|| exit 1
# Failures go to stderr so `docker compose logs` clearly flags them;
# `|| true` prevents the loop from exiting (we want it to keep retrying).
ENTRYPOINT ["/bin/sh", "-c", "while true; do node --experimental-strip-types src/cli.ts \"$BOARD_CONFIG_PATH\" || >&2 echo \"[$(date -Iseconds)] render failed; will retry in ${BOARD_TICK_SEC}s\"; sleep ${BOARD_TICK_SEC}; done"]