Skip to content

Add nx add docker to write the container files #683

Backlog

Description

@Espoir-Loem

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 Dockerfile matching docs/deployment/README.md: a Node build stage with uv sync --frozen and uv run nx build, and a Python runtime stage that serves with nx start --host 0.0.0.0 --port 8000.
  • Write a .dockerignore that 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_SECRET as 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 build followed by docker run -p 8000:8000 serves 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.md and llms.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

  1. added
    enhancement
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions