Skip to content

Production hardening — Husky pre-push, GitHub Actions CI, Dockerfile - #13

Merged
kernvex merged 2 commits into
mainfrom
feat/6-production-hardening
Jul 21, 2026
Merged

Production hardening — Husky pre-push, GitHub Actions CI, Dockerfile#13
kernvex merged 2 commits into
mainfrom
feat/6-production-hardening

Conversation

@kernvex

@kernvex kernvex commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Closes #6.

Production-readiness scaffolding that gates and packages the finished service.

What's here

  • Husky pre-push hook runs npm run verify (typecheck → lint → test, fail-fast). Escape hatch git push --no-verify documented in the hook and README.
  • GitHub Actions CI (.github/workflows/ci.yml) mirrors the gate on push/PR — Node 20, npm ci, typecheck, lint, test — then a docker build job (push: false, gated on needs: verify).
  • Multi-stage Dockerfile — builder compiles TypeScript; slim runtime runs dev-dependency-free as the non-root node user, with the data/ catalogue seed copied in (the app reads it from cwd at startup). HEALTHCHECK probes GET /health via Node's global fetch (no curl/wget in the image).
  • .dockerignore excludes node_modules, dist, .git, tests, coverage — keeps data/.
  • README with CI badge, endpoints, scripts, quality-gate, and Docker docs.

Acceptance criteria — all met

  • Husky pre-push: typecheck → lint → test, fail-fast; --no-verify documented
  • CI mirrors the hook on push/PR
  • CI docker-build job (no registry push)
  • Multi-stage Dockerfile: slim, dev-dep-free, non-root node
  • .dockerignore excludes node_modules, dist, .git, tests, coverage
  • HEALTHCHECK targets GET /health
  • CI badge in README (renders green after first run)

Verification

  • Hook fail-fast proven with an injected type error: aborted at typecheck (exit 2), lint/tests never ran.
  • Image built locally; container runs as node, serves /health and /hotels, and Docker health status reached healthy (probe exit 0).
  • npm run verify green: 54 tests pass, typecheck + lint clean.

🤖 Generated with Claude Code

kernvex and others added 2 commits July 21, 2026 14:17
…erfile

Gate and package the finished service (closes #6):

- Husky pre-push hook runs `npm run verify` (typecheck → lint → test,
  fail-fast); `git push --no-verify` documented as the escape hatch.
- GitHub Actions CI mirrors the gate (Node 20, npm ci, typecheck, lint,
  test) on push/PR, then a docker-build job (no registry push).
- Multi-stage Dockerfile: builder compiles; slim runtime runs
  dev-dependency-free as the non-root `node` user, with the catalogue
  seed copied in. HEALTHCHECK probes GET /health via Node's global fetch.
- .dockerignore excludes node_modules, dist, .git, tests, coverage.
- README with CI badge documenting endpoints, scripts, gate, and Docker.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- CI runs `npm run verify` instead of re-listing typecheck/lint/test, so the
  hook and CI share one gate definition and can't drift.
- Dockerfile sets `ENV PORT=3000` and `EXPOSE ${PORT}`, giving the port a
  single source shared by the app, EXPOSE, and the healthcheck.
- Document why CI's `push` trigger is main-only (feature branches run via PR;
  avoids double CI runs).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kernvex
kernvex merged commit 2c2f116 into main Jul 21, 2026
2 checks passed
@kernvex kernvex mentioned this pull request Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Production hardening — Husky pre-push, GitHub Actions CI, Dockerfile

1 participant