Repository navigation
Description
Problem
The deployment docs show a working multi-stage Dockerfile, but a developer has to copy it into each project and keep it in sync with the documented build and start commands. A hand-copied file can expose Node in the runtime image, omit .dockerignore, or use the wrong command.
Proposed solution
Add nx add docker (also available as nexy add docker) that writes the container files for an existing Nexy project:
- Write a
Dockerfilematchingdocs/deployment/README.md: a Node build stage withuv sync --frozenanduv run nx build, and a Python runtime stage that serves withnx start --host 0.0.0.0 --port 8000. - Write a
.dockerignorethat keeps local virtualenvs, caches, git data and__nexy__/out of the build context. - Keep the action secret out of the image and document
NEXY_ACTION_SECRETas a runtime environment variable. - Print every file changed, skip files that already have the wanted content, and leave the project unchanged on a second run, like
nx add vercel.
Acceptance criteria:
docker buildfollowed bydocker run -p 8000:8000serves the built app.- The runtime stage needs Python only; Node and Vite are not present in the final image.
- Running the command twice produces no further changes and never overwrites a file the developer owns.
- Tests cover the generated bytes, the ignore list, conflict handling and idempotency.
- A docs page explains build, run, environment variables and health checks, and is listed in
docs/README.mdandllms.txt.
Alternative solutions
Keep the Dockerfile only in docs/deployment/README.md. That avoids a new command but leaves copying and drift to every project.
Additional context
The verified source is the Docker section of docs/deployment/README.md. The command should follow the file writing behavior of nx add vercel (issue #671): data describing the generated files, no platform dependency added to the framework core, and no overwrite of a file the developer owns.
Validation
- I have searched existing issues and this is not a duplicate.
- I would be willing to help implement this feature.
Activity