Repository navigation
Conversation
- Multi-stage build on node:22-slim: install, npm run build (which runs prisma generate), prune dev deps - Runtime image runs node dist/main as the non-root node user, so SIGTERM reaches the app and its shutdown hooks run - Copy data/ into the image; the exercises module reads data/exercises.json from disk at runtime - .dockerignore keeps node_modules, dist, tests and .env files out of the build context - Document building and running the image in the README; Railway still builds with Nixpacks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch has not been deployed
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.
What
packages/backend/Dockerfile: two-stage build onnode:22-slim.npm install, thennpm run build(which already runsprisma generate), checks thatdist/main.jsexists, then prunes dev dependencies.node dist/maindirectly as the non-rootnodeuser, so SIGTERM reaches the app and its existing shutdown hooks run.data/into the image, because the exercises module readsdata/exercises.jsonfrom disk at runtime.packages/backend/.dockerignore: keepsnode_modules,dist, tests and every.env*file out of the build context, so secrets never end up in an image.Why
The backend could only be built by Railway's Nixpacks. A Dockerfile lets the same API run on any container host (local, another PaaS, or a cluster later) without changing how Railway deploys today.
Not changed
railway.tomlstill builds with Nixpacks; this PR doesn't switch Railway to the Dockerfile.prisma migrate deploystays a separate release step.Tested locally
Against a throwaway Postgres 16 with dummy Supabase and Azure OpenAI keys:
prisma migrate deployfrom the image's build stage.GET /andGET /healthreturn 200, and an authenticated route returns 401 without a token./healthreturns 503.data/.node, and.envisn't in the image.docker stopexits with code 0.Not tested with real Supabase or Azure OpenAI credentials.
For the reviewer
package-lock.jsonis gitignored, so dependency versions can differ between image builds.🤖 Generated with Claude Code