Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 2.75 KB

tarball.md

File metadata and controls

47 lines (30 loc) · 2.75 KB

Create a tarball from oci_image that can be loaded by runtimes such as podman and docker.

For example, given an :image target, you could write

oci_tarball(
    name = "tarball",
    image = ":image",
    repo_tags = ["my-repository:latest"],
)

and then run it in a container like so:

bazel run :tarball
docker run --rm my-repository:latest

oci_tarball

oci_tarball(name, format, image, loader, repo_tags)

Creates tarball from OCI layouts that can be loaded into docker daemon without needing to publish the image first.

Passing anything other than oci_image to the image attribute will lead to build time errors.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
format Format of image to generate. Options are: docker, oci. Currently, when the input image is an image_index, only oci is supported, and when the input image is an image, only docker is supported. Conversions between formats may be supported in the future. String optional "docker"
image Label of a directory containing an OCI layout, typically oci_image Label required
loader Alternative target for a container cli tool that will be used to load the image into the local engine when using bazel run on this oci_tarball.

By default, we look for docker or podman on the PATH, and run the load command.

> Note that rules_docker has an "incremental loader" which is faster than oci_tarball by design. > Something similar can be done for oci_tarball. > See loader.sh and explanation about how it works.

See the _run_template attribute for the script that calls this loader tool.
Label optional None
repo_tags a file containing repo_tags, one per line. Label required