Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 5.68 KB

rules.md

File metadata and controls

84 lines (54 loc) · 5.68 KB

Public API re-exports

buildx_build

load("@rules_buildx//buildx:defs.bzl", "buildx_build")

buildx_build(name, srcs, outs, build_context, builder_name, builder_name_prefix, buildx_flags,
             dockerfile, execution_requirements, out_dirs, output_type, path, platforms)

Runs BuildX to produce OCI images or local outputs using a Dockerfile.

The action runs with a fixed PATH plus the variables passed with --action_env. Use it for what buildx and its credential helpers need from the environment, for example --action_env=DOCKER_CONFIG=/path/to/dir, or --action_env=HOME --action_env=AWS_PROFILE for docker-credential-ecr-login.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
srcs Sources that make up the main build context.

Files are staged at the root of the context by basename. Directories (such as the output of copy_to_directory) are staged with their layout, which is the way to provide a context with subdirectories.
List of labels optional []
outs List of output files. List of strings optional []
build_context Dictionary mapping BuildX context names to buildx_context targets. Dictionary: String -> Label optional {}
builder_name Existing builder name to use. When set, this rule does not create or remove the builder.

The builder is looked up in the user's ~/.docker/buildx, so it must have been created with docker buildx create by the user running Bazel, and is only usable with local or sandboxed execution.
String optional ""
builder_name_prefix Prefix for the temporary builder name created and removed by this rule. String optional "rules_buildx_builder"
buildx_flags Additional flags to pass to docker buildx build. List of strings optional []
dockerfile Label to the Dockerfile to use for this build. Label required
execution_requirements Execution requirements for the action. Dictionary: String -> String optional {"requires-docker": "1", "requires-network": "1"}
out_dirs List of output directories. List of strings optional []
output_type BuildX output type. String optional "oci"
path Path to the main build context. String optional "."
platforms BuildX target platforms. When unset, the current Bazel target platform is used. List of strings optional []

buildx_context_local

load("@rules_buildx//buildx:defs.bzl", "buildx_context_local")

buildx_context_local(name, srcs)

Creates a reusable BuildX build context from a list of sources.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
srcs Sources to stage into this reusable BuildX context.

Files in this package are staged relative to the package; any other file, including files from external repositories, relative to the root of its repository. Two files mapping to the same path is an error.
List of labels optional []

buildx_context_oci_layout

load("@rules_buildx//buildx:defs.bzl", "buildx_context_oci_layout")

buildx_context_oci_layout(name, layout)

Creates a reusable BuildX context from an OCI layout.

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
layout OCI layout to expose as a BuildX context. Label required