Repository navigation
Build the image in stages and run compiled JavaScript - #92
Merged
Merged
Conversation
Compile with tsc at build time, so a type error fails the build instead of crash-looping the container. The runtime stage has production dependencies only, runs as the node user under tini, and has a HEALTHCHECK on /healthz. Move ts-node, typescript, @tsconfig/node22 and @types/* to devDependencies. Keep .env.* files out of the build context. Run CI on Node.js 22.23.4 to match engines.
adamshiervani
marked this pull request as ready for review
November 6, 2026 09:39
adamshiervani
added a commit
that referenced
this pull request
Nov 6, 2026
main has the Node.js 22.23.4 and Dockerfile changes as squash commits; dev has the same changes and the multi-stage Dockerfile from #92, so dev's files are kept.
adamshiervani
added a commit
that referenced
this pull request
Nov 6, 2026
… compiled image, e2e tests (#90) - #88: a new SKU's first staged release reaches devices in its bucket; no compatible default is null, not 404. - #89: new releases register at 0%, and a 0% row never displaces a rollout in progress. - #92: multi-stage Docker image; the container runs compiled dist/index.js as node under tini, with a HEALTHCHECK. - #93: e2e tests and npm run compare. DELETE /devices/:id without credentials answers 401; WebSocket upgrade and device disconnect errors are caught. A request that pins one part gets the other part from the rollout. Prerelease checks fall back to the newest of the 5 newest versions with a build for the SKU; the latest-file redirects answer 404 when the newest version has no file for the SKU.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tscin a build stage. Type errors now fail the build, not container startup.USER node,tinias init,HEALTHCHECKon/healthz. Image is 524 MB (was 828 MB).ts-node,typescript,@tsconfig/node22and@types/*todevDependencies.startrunsdist/index.js..env.*from the build context.engines.Migrations stay manual.
Tested: image build,
prisma migrate deployasnode,/healthz, Docker healthhealthy,docker stopin 254 ms,npm test(106 passed).Note
Medium Risk
Changes production container startup, process supervision, and dependency/runtime footprint; verify orchestration still passes env/PORT and health probes behave as expected.
Overview
Runtime now ships compiled JS, not ts-node.
npm startrunsnode dist/index.js,mainpoints todist/index.js, and TypeScript/ts-node tooling moves todevDependencieswithenginestightened to Node>=22.23.4 <23and a matching CI bump.Docker image is multi-stage and slimmer. A build stage runs
prisma generate,tsc, andnpm prune --omit=dev; the runtime stage copies only prodnode_modulesanddist, runs asUSER node, wraps Node withtini, and adds a/healthcheckvia/healthz..dockerignorenow drops.env.*while keeping.env.example.Risk / testing notes. Author reports image build/tests pass; ensure
HEALTHCHECKaligns with any non-defaultPORTand that any non-Docker deploy paths also use the compiled entrypoint.Reviewed by Cursor Bugbot for commit 0094779. Bugbot is set up for automated code reviews on this repo. Configure here.