Repository navigation
fix: run production images as non-root - #142
Merged
Merged
Conversation
The web templates serve from nginxinc/nginx-unprivileged as the nginx user on port 8080, and the Next.js runtime target runs as the node user. Both Next.js targets move to 8080 so they keep sharing one port.
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.
Closes #133
What changed and why
nginx:alpine(root) tonginxinc/nginx-unprivileged:alpine, matching the admin dashboard. nginx runs asnginx(uid 101) and listens on 8080. The web root is chowned tonginxbecauseentrypoint.shwritesconfig.jsthere at start; the unprivileged image already keeps its pid and temp paths in/tmp. Images stay pinned by tag, as everywhere else in this repo.runtimetarget runs asnode(uid 1000), with/appand the standalone output owned bynodeso the server can write its.nextcache. Both targets move to port 8080 so they keep sharing one port, as the Dockerfile header promises. Thedevtarget still runs as root, like the Express dev target, because the local stack bind-mounts the source over/app.listen,EXPOSE,HEALTHCHECKand the READMEdocker runexamples all move from 80 to 8080.Port change, needs a coordinated seamless-cli change
Every web container now listens on 8080 instead of 80. seamless-cli still maps 80:
src/generators/docker/docker.ts:webService()andfullStackWebService()publish127.0.0.1:5173:80and health-checkhttp://localhost/health. Both need5173:8080and:8080/health(theadminservice already uses 8080). Plus the matching assertions indocker.test.ts.verify/docker-compose.verify.yml: thereact,angular,vue,svelte,nextjsandnextjs-devservices map5173:80and health-check port 80.Because the conformance workflow runs seamless-cli main's harness against this branch, it is expected to fail here until that harness moves to 8080. The CLI pins a templates tag, so the CLI change should land with the pin bump to the release that carries this.
Checks
npm run validate: registry.json and all template manifests are valid, and every template copy matches shared/react-app.npm run format:check: All matched files use Prettier code style!npm run checkin each changed template (react-vite, react-oauth, vue, svelte, angular, nextjs): all exit 0.docker buildof each changed Dockerfile (Next.js both--target runtimeand the defaultdev), thendocker run -p <port>:8080:/health/The nginx images serve the
config.jswritten by the entrypoint, and in the Next.js runtimenodecan create files under/app/.next.