如何在oci_image中包括焦油(通过oci.pull()获得?

问题描述 投票:0回答:0
我想在我的oci_image中安装一个软件包(在这种情况下为

r-base

)。我的(不是很努力的)代码看起来像这样:

# ============ # MODULE.bazel # ============ oci.pull( name = "databricksruntime", digest = "sha256:601cf3720547f3a28847071915b1f3f3a633746cac796bf9f4ed0b7592574ec3", image = "index.docker.io/databricksruntime/standard", ) oci.pull( name = "r_base", digest = "sha256:feaff63863ff449976a4ba3935ef815b77236294f52c5e7749a179092772a456", image = "index.docker.io/library/r-base", ) use_repo(oci, "databricksruntime", "r_base") # =========== # BUILD.bazel # =========== oci_image( name = "image", base = "@databricksruntime", tars = [ "@r_base", ], )
但是,在建立时间,我的Bazel命令失败:

> bazel build //path_to_my:image File "/private/var/tmp/_bazel_stephengross/388d8b385f2abe50aa216c398c4790da/external/rules_oci~/oci/private/image.bzl", line 189, column 43, in _oci_image_impl descriptor = _calculate_descriptor(ctx, i, layer, zstd, jq, coreutils, regctl) File "/private/var/tmp/_bazel_stephengross/388d8b385f2abe50aa216c398c4790da/external/rules_oci~/oci/private/image.bzl", line 106, column 13, in _calculate_descriptor args.add(layer) Error in add: Cannot add directories to Args#add since they may expand to multiple values. Either use Args#add_all (if you want expansion) or args.add(directory.path) (if you do not).

不间断的是,我对
@r_base
(作为一个)的引用不起作用。我怀疑有一些Bazel Magic可以包裹焦油。到目前为止,我的尝试(

tar

等)已经失败。任何关于将
@r_base
tobted repo作为
tar(...); pkg_tar(...)
层中的to层的指针都得到赞赏!
    
事实证明,首选解决方案是使用
oci.pull()
(docs 
https://github.com/googlecontainertools/rules_distroless/blob/main/main/main/docs/apt.md.)。
	

containers bazel
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.