Public API re-exports
load("@rules_apko//apko:defs.bzl", "apko_config") apko_config(name, deps, config)
ATTRIBUTES
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
name | A unique name for this target. | Name | required | |
deps | List of all dependencies of the config. Transitive dependencies are included based on ApkoConfigInfo provider. | List of labels | optional | [] |
config | Config of the image. Either in source directory or generated by Bazel. When referencing other files in the config yaml file use paths relative to your Bazel workspace root. For example, if you want to reference source file foo/bar/baz use foo/bar/baz. If you want to reference output file of foo/bar:rule and rule's output file is rule.out, reference it as foo/bar/rule.out. |
Label | optional | None |
load("@rules_apko//apko:defs.bzl", "ApkoConfigInfo") ApkoConfigInfo(files)
Information about apko config. May be used when generating apko config file instead of using hardcoded ones.
When referencing other files in the config yaml file use paths relative to your Bazel workspace root. For example, if you want to reference source file foo/bar/baz use foo/bar/baz. If you want to reference output file of foo/bar:rule and rule's output file is rule.out, reference it as foo/bar/rule.out.
FIELDS
Name | Description |
---|---|
files | depset of files that will be needed for building. All of them will be added to the execution of apko commands when built with Bazel. |
load("@rules_apko//apko:defs.bzl", "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
load("@rules_apko//apko:defs.bzl", "apko_image") apko_image(name, contents, config, tag, output, architecture, args, kwargs)
Build OCI images from APK packages directly without Dockerfile
This rule creates 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.lock.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.
PARAMETERS
Name | Description | Default Value |
---|---|---|
name | of the target for the generated image. | none |
contents | Label to the contents repository generated by translate_lock. See apko-cache documentation. | none |
config | Label to the apko.yaml file. For more advanced use-cases (multi-file configuration), use target providing ApkoConfigInfo (e.g. output of apko_config rule). |
none |
tag | tag to apply to the resulting docker tarball. only applicable when output is docker |
none |
output | "oci" of "docker", | "oci" |
architecture | the 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-element"), | None |
args | additional arguments to provide when running the apko build command. |
[] |
kwargs | other common arguments like: tags, visibility. | none |
load("@rules_apko//apko:defs.bzl", "apko_lock") apko_lock(name, config, lockfile_name)
Generates executable rule for producing apko lock files.
When run, the rule will output the lockfile to the lockfile_name in the directory of the package where the rule is defined.
That is, if you define apko_lock
in foo/bar/BUILD.bazel
with lockfile_name="baz.lock.json
the rule will output the lock into
foo/bar/baz.lock.json
.
PARAMETERS