Repository navigation
add layer for npm packages - #1346
Conversation
fc8fda8 to
48d72b5
Compare
|
/assign @smukherj1 |
|
Just tested these changes on our internal repository and looks like it's working as expected after |
48d72b5 to
6076627
Compare
6076627 to
10c54d8
Compare
|
Nice. I'm glad to see the I'd like to dig into this a bit further and understand it in detail next week as this was something the @Globegitter started working on here bazel-contrib/rules_nodejs#863 but that was before we had Fr the platform choice of node to put in the docker image I think that should be controlled with the There's an example usage in https://github.com/bazelbuild/rules_nodejs/blob/master/examples/nestjs/src/BUILD.bazel#L48: |
| return depset(transitive = depsets) | ||
|
|
||
| def _app_layer_impl(ctx): | ||
| return lang_image.implementation(ctx, runfiles = _runfiles, emptyfiles = _emptyfiles) |
There was a problem hiding this comment.
where is the entrypoint now being set since you're not calling app_layer any longer?
There was a problem hiding this comment.
Not sure what you're referring to as the entrypoint, do you mean the entry_point that exists on a nodejs_binary?
Because that gets collected via the DeafultInfo of the nodejs_binary on _app_layer_impl.
Note the ./app/testdata/nodejs_image_binary.runfiles/io_bazel_rules_docker/testdata/nodejs_image_binary.sh in the above test, that's the script called to start the process inside the container.
There was a problem hiding this comment.
Let me expand a little on my question.
Currently, if you run a nodehs_image target, the entrypoint to the container is set here. When I print its value for //container/nodejs:nodejs_image the entrypoint to the container is set to "/app/tests/container/nodejs/nodejs_image.binary"
Now in your change, you are replacing the call to app_layer in nodejs/image/bzl for a call to _app_layer. the rule _app_layer is implemented by _app_layer_impl which in turn is calling lang_image.implementation(ctx, runfiles = _runfiles, emptyfiles = _emptyfiles). This call to lang_image.implementation is not setting any value for the entrypoint of the container. So where is the value for the entrypoint for the nodejs_image now being set?
There was a problem hiding this comment.
Ah I think I understand, initally I though we'd need a app specific layer there. But turns out it's not needed. I've switched back to use the app_layer from //lang:image.bzl.
Which should fix up the entrypoint issues
|
Added more details to my question. Do let me know when this is ready for another review (i.e., make sure buildkite tests are passing) |
ad899ad to
c7d26fa
Compare
|
@nlopezgi Should be good for review again, addressed those points and CI is green. |
|
/gcbrun |
|
The nodejs image integration test is failing. Failure corresponds to this line. You can probably repro it locally by running |
31faed1 to
52636be
Compare
|
I ran |
|
|
52636be to
d8e5b13
Compare
|
/gcbrun |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nlopezgi, Toxicable The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds support for
NodeRuntimeDepsInfoandNpmPackageInfoThis ensures that npm deps are placed in their own layer, improving caching and rebuilds
Also puts nodejs and nodejs args so that it can be cached between instances of nodejs_image targets.
based off work started here https://github.com/bazelbuild/rules_docker/pull/487/files