Skip to content

fix(docker): build Python node images without a requirements.txt - #647

Closed
Siddhanthguptaa wants to merge 1 commit into
ControlCore-Project:devfrom
Siddhanthguptaa:fix/dockerfile-py-build-context
Closed

Siddhanthguptaa wants to merge 1 commit into
ControlCore-Project:devfrom
Siddhanthguptaa:fix/dockerfile-py-build-context

Conversation

@Siddhanthguptaa

Copy link
Copy Markdown

Fixes #646

The generated docker-<node>/ build directory has no requirements.txt unless the node's .dir provides one, so COPY requirements.txt . in Dockerfile.py failed for every Python node. Dockerfile.py now installs numpy and pyzmq (all that concore.py/concore_base.py import) in their own layer before COPY . ., so it is cached across nodes, and installs requirements.txt only if it is present. Building from the repo root (as the CI docker-build job does) still installs requirements.txt. The RUN is kept on one line so CRLF checkouts can't break a \ continuation.

Testing (Windows 11, Docker 29.4)

  • Before: python mkconcore.py demo/sample.graphml demo out docker && cd out && ./build fails at COPY requirements.txt ..
  • After: both images build, and ./run completes the study (both nodes reach simtime 150, containers exit 0).
  • Only Dockerfile.py changes; mkconcore.py is untouched.

Note: nodes that need more packages (e.g. scipy/matplotlib in demo/plotym.py, ratc/*) get them by shipping a requirements.txt in the node's .dir, which is already copied into the build context.

mkconcore's per-node docker build dir only has a requirements.txt when
the node's .dir provides one, so `COPY requirements.txt .` failed for
every generated Python node. Install numpy and pyzmq, and install
requirements.txt only when it is present.
@Siddhanthguptaa

Copy link
Copy Markdown
Author

Closing for now to keep my open PRs to a number I can follow up on properly. Happy to reopen if this is wanted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant