最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

containers - How to include a tar (obtained via oci.pull()) in an oci_image? - Stack Overflow

programmeradmin3浏览0评论

I want to install a package (in this case, r-base) as a layer in my oci_image. My (not-quite-working) code looks like this:

# ============
# 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",
    ],
)

At build time, however, my Bazel command fails:

> 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).

Unsurprisingly, my reference to @r_base (as a tar) is not working. I suspect there's some Bazel magic to wrap @r_base into a tar; thus far my attempts (tar(...); pkg_tar(...), etc.) have failed. Any pointers on getting the oci.pull()-obtained repo as a tar layer in oci_image are appreciated!

发布评论

评论列表(0)

  1. 暂无评论