{"id":20148206,"url":"https://github.com/chainguard-dev/rules_apko","last_synced_at":"2026-02-26T01:26:36.986Z","repository":{"id":185166866,"uuid":"673087108","full_name":"chainguard-dev/rules_apko","owner":"chainguard-dev","description":"Bazel rules for apko","archived":false,"fork":false,"pushed_at":"2024-11-13T19:00:07.000Z","size":336,"stargazers_count":25,"open_issues_count":27,"forks_count":16,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-13T11:23:28.763Z","etag":null,"topics":["apk","bazel","bazel-rules","no-ghaudit-default-permissions"],"latest_commit_sha":null,"homepage":"https://apko.dev","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chainguard-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-31T20:59:09.000Z","updated_at":"2024-11-13T19:00:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"e324a085-8230-45d2-9d3c-aafdf6009ae2","html_url":"https://github.com/chainguard-dev/rules_apko","commit_stats":null,"previous_names":["chainguard-dev/rules_apko"],"tags_count":16,"template":false,"template_full_name":"bazel-contrib/rules-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainguard-dev%2Frules_apko","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainguard-dev%2Frules_apko/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainguard-dev%2Frules_apko/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chainguard-dev%2Frules_apko/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chainguard-dev","download_url":"https://codeload.github.com/chainguard-dev/rules_apko/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241587798,"owners_count":19986628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apk","bazel","bazel-rules","no-ghaudit-default-permissions"],"created_at":"2024-11-13T22:35:21.607Z","updated_at":"2026-02-02T12:53:07.646Z","avatar_url":"https://github.com/chainguard-dev.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bazel rules for apko\n\nWraps the https://github.com/chainguard-dev/apko tool for use under Bazel.\n\nNeed help? This ruleset has support provided by \u003chttps://aspect.dev\u003e.\n\n## Installation\n\nFollow instructions in the release notes from the release you wish to use.\nBe sure to follow the \"Initial Setup\" instructions as well.\n\u003chttps://github.com/chainguard-dev/rules_apko/releases\u003e\n\nTo use a commit rather than a release, you can point at any SHA of the repo,\nusing the GitHub-provided source archive like\n`https://github.com/chainguard-dev/rules_apko/archive/abc123.tar.gz``\n\n\u003e [!NOTE]  \n\u003e Note that GitHub source archives don't have a strong guarantee on the sha256 stability.\n\u003e See https://github.blog/2023-02-21-update-on-the-future-stability-of-source-code-archives-and-hashes/\n\n## Usage\n\nApko usage begins with an `apko.yaml` configuration file. The `apko lock` tool will create a corresponding\n`apko.lock.json` file, and this is where Bazel will read to fetch external content.\nAssuming `rules_apko` is already loaded in your `MODULE.bazel` or `WORKSPACE` file one can call:\n`bazel run @rules_apko//apko -- lock ./apko.yaml` to lock the dependencies and generate `apko.lock.json` file.\n\nThen you import these base layers into Bazel:\n\n- With Bazel 6 and [bzlmod], call `apk.translate_lock` in `MODULE.bazel`\n- Otherwise, call `translate_apko_lock` in `WORKSPACE`\n\nNow you can use the `apko_image` rule to build the image, producing an OCI format output.\nAs long as the apko `.yaml` file is in the same directory as the `apko_image` you can periodically refresh the\n`apko.lock.json` file by just calling: `bazel run path/to/image.lock`.\nAlternatively you can call `apko lock path/to/apko.yaml` or `bazel run @rules_apko//apko lock path/to/apko.yaml`\nto regenerate the `apko.lock.json` file manually.\nTo resolve all the files in the repository, such a [snippet](./examples/lock.sh) can be useful.\n\nFinally, we recommend using \u003chttps://github.com/bazel-contrib/rules_oci\u003e as the next step in your Bazel build\nto add application code from your repo as the next layers of the image.\n\nSee the examples folder in this repository, which relies on base layers declared in `/MODULE.bazel`.\n\nAlso see the `e2e` folder in this repository, where we declare our end-to-end test.\n\n## Public API\n\n- [translate_lock](./docs/translate_lock.md) Repository rules for translating `apko.lock.json`\n- [rules](./docs/rules.md) Build OCI images from APK packages directly without `Dockerfile`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainguard-dev%2Frules_apko","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchainguard-dev%2Frules_apko","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchainguard-dev%2Frules_apko/lists"}