我对 Bazel 比较陌生,但这花费的时间比我认为的要长。我yarn_install
在我的工作区做,我只是想引用安装的node_modules
,这样我就可以把它们放在我的新 docker 容器中。
工作区
yarn_install(
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)
构建.bazel
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
nodejs_image(
name = "webapi_image",
# gets all the files in my directory
data = glob(
[
"**/*",
],
# references the node modules, but doesn't work :(
) + ["@npm//node_modules"],
entry_point = "//:app.js",
)
我已经能够获得特定的软件包(即@npm//express
)但是如果我尝试访问 node_modules 那么我就会得到
no such package '@npm//node_modules': Package is considered deleted due to --deleted_packages and referenced by '//:webapi_image'