Skip to content

fix(docker): the images could build green and ship without an entrypoint - #419

Merged
beyondnetPeru merged 1 commit into
developfrom
fix/dockerignore-tsbuildinfo
Aug 4, 2026
Merged

fix(docker): the images could build green and ship without an entrypoint#419
beyondnetPeru merged 1 commit into
developfrom
fix/dockerignore-tsbuildinfo

Conversation

@beyondnetPeru

Copy link
Copy Markdown
Contributor

Found by deploying the Core to kind: the container met CrashLoopBackOff with

Error: Cannot find module '/repo/src/apps/core-api/dist/main'

from an image whose build had exited 0.

Cause

The repository had no .dockerignore. All three service Dockerfiles do COPY src ./src and then build inside the image with npx tsc -b — a composite build, which reads .tsbuildinfo to decide what still needs emitting. The working tree's .tsbuildinfo files rode into the build context, tsc -b concluded the output was already current, and emitted nothing. The image carried a dist/ with most of its files and no main.js.

CI never saw it and could not: CI builds from a fresh checkout, which has no .tsbuildinfo. The inverse of the usual failure — green in CI, broken on every developer machine that had built before.

Fix

Two changes, because the first alone would only close the trigger someone happened to know about.

  • .dockerignore excludes **/*.tsbuildinfo (the cause), plus **/dist, **/node_modules and the usual noise. Every runner stage copies --from=builder, so a host dist was never the shipped artifact — letting it into the context only risked a stale build passing as fresh.
  • Each Dockerfile asserts its own entrypoint after building, so an image without one fails the build rather than a cluster.

Verification — the assertion was watched failing, not assumed able to

Condition Result
11 .tsbuildinfo present in the tree All three images build; each carries its dist/main.js
Assertion pointed at a path that does not exist Build red, prints its diagnosis
**/*.tsbuildinfo line commented out Build red — at tsc -b (exit 2), not the assertion, because **/dist is excluded too, so the silent no-op becomes a loud error

Both doors are shut; only one of them was the original.

Guard Result
ci-runner.mjs governance ✅ 17 scripts
56-validate-docker-workspace-closure ✅ 4 images, 663 sources
gitleaks dir . ✅ exit 0

🤖 Generated with Claude Code

Found by deploying the Core to kind: the container met CrashLoopBackOff
with `Cannot find module '/repo/src/apps/core-api/dist/main'` from an
image whose build had exited 0.

The repository had NO `.dockerignore`. All three service Dockerfiles do
`COPY src ./src` and then build inside the image with `npx tsc -b`, which
is a COMPOSITE build: it reads `.tsbuildinfo` to decide what still needs
emitting. The working tree's `.tsbuildinfo` files rode into the context,
`tsc -b` concluded the output was already current, and emitted nothing.
The image carried a `dist/` with most of its files and no `main.js`.

CI never saw it, and could not: CI builds from a fresh checkout, which has
no `.tsbuildinfo`. The inverse of the usual failure — green in CI, broken
on every developer machine that had built before.

Two changes, because the first alone would only close the trigger anyone
happens to know about:

  - `.dockerignore` excludes `**/*.tsbuildinfo` (the cause) and `**/dist`,
    `**/node_modules` and the usual noise. Every runner stage copies
    `--from=builder`, so a host `dist` was never the shipped artifact —
    letting it into the context only risked a stale build passing as fresh.
  - each Dockerfile asserts its own entrypoint after building, so an image
    without one fails the BUILD rather than a cluster.

Verified by measurement, and the assertion was WATCHED failing rather than
assumed able to:

  - with 11 `.tsbuildinfo` present in the tree, all three images now build
    and each carries its `dist/main.js`;
  - pointed at a path that does not exist, the assertion turns the build
    red and prints its diagnosis;
  - with the `**/*.tsbuildinfo` line commented out, the build fails too —
    at `tsc -b` (exit 2) rather than at the assertion, because `**/dist`
    is excluded as well, so the silent no-op becomes a loud error. Both
    doors are shut; only one of them was the original.

Guards: governance suite 17/17, 56-validate-docker-workspace-closure OK
(4 images, 663 sources), gitleaks clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@beyondnetPeru
beyondnetPeru requested a review from a team as a code owner August 4, 2026 04:30
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

📊 Bilingual Coverage Impact

PR Changes

  • Paired EN/ES files modified: 0
  • New EN files needing ES translation: 0

Repository Coverage

Metric Value
Total EN files 526
Total ES files 500
Paired files 0
Coverage 0%

Good: All EN changes have ES counterparts.


Generated by GitHub Actions

@beyondnetPeru
beyondnetPeru merged commit 76d6340 into develop Aug 4, 2026
34 checks passed
@beyondnetPeru
beyondnetPeru deleted the fix/dockerignore-tsbuildinfo branch August 4, 2026 04:36
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.

1 participant