-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm packages Docker integration #116
Comments
We haven't tried this at all so far. Maybe @thesayyn has some ideas since he has worked on both sides of this. |
Hmm, I suspect a few things that could go wrong here; 1- container_layer mishandles TreeArtifact symlinks. (this is more likely given the side note) I'd like to take a look if you could provide a repro. |
Hey @thesayyn! Here's the repro. My understanding is that the symlinks mishandling starts in the |
Thanks! I'll take a look |
I made a comment on an existing pkg_tar issue about this limitation: bazelbuild/rules_pkg#115 (comment) |
Yeah I think that's the principled answer, do we know how hard that is to contribute? |
#249 fixes this issue. if you want to have more fine-grained layers eg node_modules into their own layer, one has to modify the expand_runfiles function to yield more than one tar. |
I'm wondering what are the current limitations to build a Docker image out of targets created using rules_js. I'm able to create a tar from the
ts_project
rule orswc
from rules_swc, but I'm struggling with bundling the npm packages.I've tried to use the container_layer rule to create a npm_deps layer that is copied to the
/node_modules
of my image:The problem is, indirect dependencies end up exclusively inside .aspect_rules_js (
follow-redirects
is an indirect dependency ofaxios
):In the following example,
lodash.camelcase
is an indirect dependency of an external npm package. When running my Docker container, it fails with:That makes sense since one of the npm packages tried to import it but it isn't linked (but is available inside
.aspect_rules_js
). Is there a way to get the indirect dependencies also linked to the node_modules?As a side note, symlinks seem to become the whole directory copied, so there are three
axios
and twofollow-redirects
(I'm limiting thetree
to 2 subdirectories, but inside the node_modules of packages in.aspect_rules_js
the duplication happens).The text was updated successfully, but these errors were encountered: