Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Latest commit

 

History

History
463 lines (441 loc) · 15 KB

README.md

File metadata and controls

463 lines (441 loc) · 15 KB

Bazel Package Manager Rules

Rules in this directory provide functionality to install packages inside docker containers. Note these rules require a docker binary to be present and configured properly via docker toolchain rules.

Package Manager Rules

add_apt_key

add_apt_key(name, base, build_layer, cmd, commands, create_image_config, creation_time, data_path, debs, directory, docker_run_flags, empty_dirs, empty_files, entrypoint, env, extract_config, extract_file, files, gpg_image, gzip, image, incremental_load_template, join_layers, keys, label_file_strings, label_files, labels, launcher, launcher_args, layers, legacy_repository_naming, legacy_run_behavior, mode, null_cmd, null_entrypoint, operating_system, output_file, ports, repository, sha256, stamp, symlinks, tars, user, volumes, workdir)

Attributes

name Name; required

A unique name for this target.

base Label; optional
build_layer Label; optional
cmd List of strings; optional
commands List of strings; optional

Redeclared from _extract to be non-mandatory, do not set.

create_image_config Label; optional
creation_time String; optional
data_path String; optional
debs List of labels; optional
directory String; optional
docker_run_flags List of strings; optional

Extra flags to pass to the docker run command.

empty_dirs List of strings; optional
empty_files List of strings; optional
entrypoint List of strings; optional
env Dictionary: String -> String; optional
extract_config Label; optional
extract_file String; optional

Redeclared from _extract to be non-mandatory, do not set.

files List of labels; optional
gpg_image Label; optional

If set, keys will be pulled and installed in the given image, the result of this installation will then be transfered to the image passed as base

gzip Label; optional
image Label; required

The image to run the commands in.

incremental_load_template Label; optional
join_layers Label; optional
keys List of labels; required

List of keys (each, a file target) to be installed in the container.

label_file_strings List of strings; optional
label_files List of labels; optional
labels Dictionary: String -> String; optional
launcher Label; optional
launcher_args List of strings; optional
layers List of labels; optional
legacy_repository_naming Boolean; optional
legacy_run_behavior Boolean; optional

If set to False, `bazel run` will directly invoke `docker run` with flags specified in the `docker_run_flags` attribute. Note that it defaults to False when using _image rules.

mode String; optional
null_cmd Boolean; optional
null_entrypoint Boolean; optional
operating_system String; optional
output_file String; optional

Redeclared from _extract to be non-mandatory, do not set.

ports List of strings; optional
repository String; optional
sha256 Label; optional
stamp Boolean; optional
tars List of labels; optional
user String; optional
volumes List of strings; optional
workdir String; optional

download_pkgs

download_pkgs(name, additional_repos, image_tar, packages)

This rule creates a script to download packages within a container. The script bundles all the packages in a tarball.

Attributes

name Name; required

A unique name for this target.

additional_repos List of strings; optional

list of additional debian package repos to use, in sources.list format

image_tar Label; required

The image tar for the container used to download packages.

packages List of strings; required

list of packages to download. e.g. ['curl', 'netbase']

install_pkgs

install_pkgs(name, image_tar, installables_tar, installation_cleanup_commands, output_image_name)

This rule install deb packages, obtained via a download_pkgs rule, within a container.

Attributes

name Name; required

A unique name for this target.

image_tar Label; required

The image tar for the container used to install packages.

installables_tar Label; required

Tar with deb installables, should be a tar produced by a download_pkgs rule.

installation_cleanup_commands String; optional

Commands to run after installation, to e.g., remove or otherwise modify files created during installation.

output_image_name String; optional

Name of container_image produced with the packages installed. By default the label of the target will be used. *Must be unique* across the entire build tree.