Skip to main content
Version: 1.0.x


Public API re-exports


apko_image(name, architecture, args, config, contents, output, tag)

Build OCI images from APK packages directly without Dockerfile

This rule creates Alpine images using the 'apko.yaml' configuration file and relies on cache contents generated by translate_lock to be fast.

name = "example",
config = "apko.yaml",
contents = "@example_lock//:contents",
tag = "example:latest",

The label @example_lock//:contents is generated by the translate_lock extension, which consumes an 'apko.resolved.json' file. For more details, refer to the documentation.

An example demonstrating usage with rules_oci

name = "alpine_base",
config = "apko.yaml",
contents = "@alpine_base_lock//:contents",
tag = "alpine_base:latest",

name = "app",
base = ":alpine_base"

For more examples checkout the examples directory.


nameA unique name for this target.Namerequired
architecturethe CPU architecture which this image should be built to run on. See""
argsadditional arguments to provide when running the apko build command.List of stringsoptional[]
configLabel to the apko.yaml file.Labelrequired
contentsLabel to the contents repository generated by translate_lock. See apko-cache documentation.Labelrequired
tagtag to apply to the resulting docker tarball. only applicable when output is dockerStringrequired


apko_bazelrc(name, repositories, kwargs)

Helper macro for generating .bazelrc and files to allow for partial package fetches.

See initial setup documentation for more information.


NameDescriptionDefault Value
namename of the target"apko_bazelrc"
repositorieslist of repositories to generate .bazelrc for["", ""]
kwargspassed to expanding targets. only well known attributes such as tags testonly ought to be present.none