Repository navigation
feat(workspace): build an image for a single workspace member - #32
Merged
Merged
Conversation
…install The output directory is only created by the installers, so dockerizing a project without any dependency to install failed with a `FileNotFoundError` when writing the entrypoint.
Running `pdm dockerize` from a workspace member, or targeting it with
`--project`, now builds an image for that member only, instead of being
rejected: its own dependencies are installed, including the sibling members
it depends on, and the members it does not depend on are left out.
The member provides the dependencies, the groups, the scripts, the
`tool.pdm.dockerize` settings and the output directory, while the workspace
root keeps providing the lock file, the interpreter, the sources and the
`use_uv` setting.
The environment is deliberately kept rooted at the workspace root: resolving
the interpreter from a member would create a virtualenv inside it, and
expanding `${PROJECT_ROOT}` with its backend would point at paths which do
not exist.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #32 +/- ##
==========================================
+ Coverage 94.82% 94.90% +0.07%
==========================================
Files 6 6
Lines 464 471 +7
Branches 69 69
==========================================
+ Hits 440 447 +7
Misses 21 21
Partials 3 3 ☔ View full report in Codecov by Harness. |
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.
Follow-up to #31, which added workspace support but restricted
pdm dockerizeto the workspace root.Running the command from a member, or targeting it with
--project, now builds an image for that member only:The member's own dependencies are installed, including the sibling members it depends on, while the members it does not depend on are left out. Like any dockerized project, the member itself is not installed: its sources are exposed through
PYTHONPATH.The member provides the dependencies, the groups, the scripts, the
tool.pdm.dockerizesettings and the output directory. The workspace root keeps providing the lock file, the interpreter, the package indexes and theuse_uvsetting — nothing is inherited in either direction.Building a single image for the whole workspace, by running the command from the root, is unchanged.
Also fixes an unrelated pre-existing bug: dockerizing a project without any dependency failed with a
FileNotFoundError, as the output directory is only created by the installers.