Skip to main content
Version: 1.0.x

rules

Public API re-exports

apko_image

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.

apko_image(
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

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

oci_image(
name = "app",
base = ":alpine_base"
)

For more examples checkout the examples directory.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
architecturethe CPU architecture which this image should be built to run on. See https://github.com/chainguard-dev/apko/blob/main/docs/apko_file.md#archs-top-level-elementStringoptional""
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
output-Stringoptional"oci"
tagtag to apply to the resulting docker tarball. only applicable when output is dockerStringrequired

apko_bazelrc

apko_bazelrc(name, repositories, kwargs)

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

See initial setup documentation for more information.

PARAMETERS

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